Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
Only set env vars near the end
Browse files Browse the repository at this point in the history
Improves the reusability of layers as it adds those env vars
to each RUN command, so they look unique, even though the
run commands are not using the env vars.
  • Loading branch information
nicksellen committed Mar 25, 2024
1 parent 67bd33f commit 789a5e7
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Dockerfile
Expand Up @@ -67,12 +67,6 @@ EOF

FROM docker.io/python:${PYTHON_VERSION}-slim-bookworm as runner

ARG KARROT_VERSION="unknown"
ENV KARROT_VERSION="${KARROT_VERSION}"

ARG KARROT_COMMIT="unknown"
ENV KARROT_COMMIT="${KARROT_COMMIT}"

ENV PYTHONUNBUFFERED=1

# Only dependencies needed for runtime
Expand Down Expand Up @@ -123,4 +117,13 @@ USER $USERNAME

COPY docker/entrypoint.sh /entrypoint.sh

# Keep these near the end, as they are added to any RUN commands
# which means new layers are created when just the version/commit
# has changed
ARG KARROT_VERSION="unknown"
ENV KARROT_VERSION="${KARROT_VERSION}"

ARG KARROT_COMMIT="unknown"
ENV KARROT_COMMIT="${KARROT_COMMIT}"

ENTRYPOINT ["/entrypoint.sh"]

0 comments on commit 789a5e7

Please sign in to comment.