diff --git a/.github/workflows/test-dockerfile.yml b/.github/workflows/test-dockerfile.yml index 31c71a6..59fb05e 100644 --- a/.github/workflows/test-dockerfile.yml +++ b/.github/workflows/test-dockerfile.yml @@ -22,11 +22,16 @@ jobs: run: docker save --output /tmp/image.tar test:latest - name: Extract layer - run: tar -C /tmp -x -f /tmp/image.tar --wildcards '*layer.tar' --strip-components=1 + run: | + tar -C /tmp -x -f /tmp/image.tar --strip-components=1 + if [ ! -d /tmp/sha256 ]; then + echo 'Cannot extract docker archive.' + exit 1 + fi - name: Check layer contents run: | - ENTRY="$(tar -v -t -f /tmp/layer.tar --wildcards '*bin/install-php-extensions')" + ENTRY="$(find /tmp/sha256 -type f -exec tar -vtf {} \; 2>/dev/null | grep install-php-extensions)" if [ -z "$ENTRY" ]; then echo 'File not found' exit 1 diff --git a/Dockerfile b/Dockerfile index 0cbb001..ae089a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,6 @@ -FROM bash AS build - -COPY install-php-extensions /tmp/install-php-extensions -RUN chmod +x /tmp/install-php-extensions - FROM scratch -LABEL org.opencontainers.image.source="https://github.com/mlocati/docker-php-extension-installer" \ - org.opencontainers.image.licenses="MIT" +LABEL org.opencontainers.image.source="https://github.com/mlocati/docker-php-extension-installer" +LABEL org.opencontainers.image.licenses="MIT" -COPY --from=build /tmp/install-php-extensions /usr/bin/install-php-extensions +COPY --chmod=755 install-php-extensions /usr/bin/install-php-extensions