Skip to content

Commit d8a138c

Browse files
authored
Simplify Dockerfile (#960)
* Simplify Dockerfile * Update test-dockerfile.yml
1 parent 09aee31 commit d8a138c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

.github/workflows/test-dockerfile.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,16 @@ jobs:
2222
run: docker save --output /tmp/image.tar test:latest
2323
-
2424
name: Extract layer
25-
run: tar -C /tmp -x -f /tmp/image.tar --wildcards '*layer.tar' --strip-components=1
25+
run: |
26+
tar -C /tmp -x -f /tmp/image.tar --strip-components=1
27+
if [ ! -d /tmp/sha256 ]; then
28+
echo 'Cannot extract docker archive.'
29+
exit 1
30+
fi
2631
-
2732
name: Check layer contents
2833
run: |
29-
ENTRY="$(tar -v -t -f /tmp/layer.tar --wildcards '*bin/install-php-extensions')"
34+
ENTRY="$(find /tmp/sha256 -type f -exec tar -vtf {} \; 2>/dev/null | grep install-php-extensions)"
3035
if [ -z "$ENTRY" ]; then
3136
echo 'File not found'
3237
exit 1

Dockerfile

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
FROM bash AS build
2-
3-
COPY install-php-extensions /tmp/install-php-extensions
4-
RUN chmod +x /tmp/install-php-extensions
5-
61
FROM scratch
72

8-
LABEL org.opencontainers.image.source="https://github.com/mlocati/docker-php-extension-installer" \
9-
org.opencontainers.image.licenses="MIT"
3+
LABEL org.opencontainers.image.source="https://github.com/mlocati/docker-php-extension-installer"
4+
LABEL org.opencontainers.image.licenses="MIT"
105

11-
COPY --from=build /tmp/install-php-extensions /usr/bin/install-php-extensions
6+
COPY --chmod=755 install-php-extensions /usr/bin/install-php-extensions

0 commit comments

Comments
 (0)