Skip to content

Commit

Permalink
Dockerfile: fail on errors
Browse files Browse the repository at this point in the history
Rewrite the if-then-else into
short-circuiting tests followed
by commands chained together
with &&. This makes building
the image fail if something is wrong,
instead of giving strange errors
when running the tests.
  • Loading branch information
pjonsson authored and omad committed Jun 13, 2024
1 parent e61893e commit e3bc788
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@ COPY . $APPDIR
COPY --from=builder --link /build/*.whl ./
RUN python3.10 -m pip --disable-pip-version-check -q install *.whl && \
rm *.whl && \
if [ "$ENVIRONMENT" = "deployment" ] ; then\
pip --no-cache-dir --disable-pip-version-check install .[$ENVIRONMENT]; \
rm -rf /code/* /code/.git* ; \
else \
pip --disable-pip-version-check install --editable .[$ENVIRONMENT]; \
fi && \
([ "$ENVIRONMENT" = "deployment" ] || \
pip --disable-pip-version-check install --editable .[$ENVIRONMENT]) && \
([ "$ENVIRONMENT" != "deployment" ] || \
(pip --no-cache-dir --disable-pip-version-check install .[$ENVIRONMENT] && \
rm -rf /code/* /code/.git*)) && \
pip freeze && \
([ "$ENVIRONMENT" != "deployment" ] || \
apt-get remove -y \
Expand Down

0 comments on commit e3bc788

Please # to comment.