Skip to content

Commit

Permalink
Remove sources from development DOCKER_TARGET
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinMind committed Oct 18, 2024
1 parent d25666d commit a871f7d
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ EOF
ARG DOCKER_TARGET
ENV DOCKER_TARGET=${DOCKER_TARGET}

# Add our custom mime types (required for for ts/json/md files)
COPY docker/etc/mime.types /etc/mime.types


# Define production dependencies as a single layer
# let's the rest of the stages inherit prod dependencies
# and makes copying the /deps dir to the final layer easy.
Expand All @@ -115,7 +119,10 @@ ${PIP_COMMAND} install --progress-bar=off --no-deps --exists-action=w -r require
npm ci ${NPM_ARGS} --include=prod
EOF

FROM base AS pip_development
# In the local development image, we stop with dependencies
# Everything else is about compiling production assets which is not needed
# in the typical development workflow.
FROM base AS development

RUN \
# Files required to install pip dependencies
Expand Down Expand Up @@ -168,29 +175,16 @@ echo "from olympia.lib.settings_base import *" > settings_local.py
DJANGO_SETTINGS_MODULE="settings_local" make -f Makefile-docker update_assets
EOF

FROM base AS sources
FROM base AS production

ARG DOCKER_BUILD DOCKER_COMMIT DOCKER_VERSION

ENV DOCKER_BUILD=${DOCKER_BUILD}
ENV DOCKER_COMMIT=${DOCKER_COMMIT}
ENV DOCKER_VERSION=${DOCKER_VERSION}

# Add our custom mime types (required for for ts/json/md files)
COPY docker/etc/mime.types /etc/mime.types
# Copy the rest of the source files from the host
COPY --chown=olympia:olympia . ${HOME}

# Set shell back to sh until we can prove we can use bash at runtime
SHELL ["/bin/sh", "-c"]

FROM sources AS development

# Copy dependencies from `pip_development`
COPY --from=pip_development --chown=olympia:olympia /deps /deps

FROM sources AS production

# Copy compiled locales from builder
COPY --from=locales --chown=olympia:olympia ${HOME}/locale ${HOME}/locale
# Copy assets from assets
Expand All @@ -199,4 +193,5 @@ COPY --from=assets --chown=olympia:olympia ${HOME}/static-build ${HOME}/static-b
# Copy dependencies from `pip_production`
COPY --from=pip_production --chown=olympia:olympia /deps /deps


# Set shell back to sh until we can prove we can use bash at runtime
SHELL ["/bin/sh", "-c"]

0 comments on commit a871f7d

Please sign in to comment.