Skip to content

Commit 25fbf83

Browse files
author
Bryan Latten
committed
Dockerfile: testing in multi-stage isolation
1 parent aebaaf7 commit 25fbf83

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

Dockerfile-7.4

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM behance/docker-nginx:9.0
1+
FROM behance/docker-nginx:9.0 as output
22
LABEL maintainers="Behance Team <dev-behance@adobe.com>"
33

44
# Set TERM to suppress warning messages.
@@ -138,9 +138,13 @@ RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \
138138
# Run standard set of tweaks to ensure runs performant, reliably, and consistent between variants
139139
/bin/bash -e /scripts/prep-php.sh
140140

141+
# TESTING PHASE: using multi-stage to isolate any possible side effects
142+
FROM output as testenvironment
141143

142144
# HACK: workaround for https://github.com/aelsabbahy/goss/issues/392
143145
# Run the child and parent test configs separately instead of leveraging inheritance
144146
RUN goss -g /tests/php-fpm/7.4.goss.yaml validate && \
145-
goss -g /tests/php-fpm/base.goss.yaml validate && \
146-
/aufs_hack.sh
147+
goss -g /tests/php-fpm/base.goss.yaml validate
148+
149+
# Output the final image
150+
FROM output

Dockerfile-7.4-alpine

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM behance/docker-nginx:9.0-alpine
1+
FROM behance/docker-nginx:9.0-alpine as output
22
LABEL maintainers="Behance Team <dev-behance@adobe.com>"
33

44
# Set TERM to suppress warning messages.
@@ -130,8 +130,12 @@ RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \
130130
ln -s /usr/sbin/php-fpm7 /usr/sbin/php-fpm && \
131131
/bin/bash -e /scripts/prep-php.sh
132132

133+
# TESTING PHASE: using multi-stage to isolate any possible side effects
134+
FROM output
133135
# HACK: workaround for https://github.com/aelsabbahy/goss/issues/392
134136
# Run the child and parent test configs separately instead of leveraging inheritance
135137
RUN goss -g /tests/php-fpm/7.4-alpine.goss.yaml validate && \
136-
goss -g /tests/php-fpm/base.goss.yaml validate && \
137-
/aufs_hack.sh
138+
goss -g /tests/php-fpm/base.goss.yaml validate
139+
140+
# Output the final image
141+
FROM output

Dockerfile-8.0

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM behance/docker-nginx:9.0
1+
FROM behance/docker-nginx:9.0 as output
22
LABEL maintainers="Behance Team <dev-behance@adobe.com>"
33

44
# Set TERM to suppress warning messages.
@@ -133,8 +133,13 @@ RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \
133133
# Run standard set of tweaks to ensure runs performant, reliably, and consistent between variants
134134
/bin/bash -e /scripts/prep-php.sh
135135

136+
# TESTING PHASE: using multi-stage to isolate any possible side effects
137+
FROM output as testenvironment
138+
136139
# HACK: workaround for https://github.com/aelsabbahy/goss/issues/392
137140
# Run the child and parent test configs separately instead of leveraging inheritance
138141
RUN goss -g /tests/php-fpm/8.0.goss.yaml validate && \
139-
goss -g /tests/php-fpm/base.goss.yaml validate && \
140-
/aufs_hack.sh
142+
goss -g /tests/php-fpm/base.goss.yaml validate
143+
144+
# Output the final image
145+
FROM output

0 commit comments

Comments
 (0)