Skip to content

Commit

Permalink
Merge pull request saleor#5912 from patrys/faster-docker-rebuild
Browse files Browse the repository at this point in the history
Reorder Dockerfile commands to cache as many layers as possible
  • Loading branch information
maarcingebala authored Jul 24, 2020
2 parents a5c774a + dae8e38 commit 8dea48a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ RUN pip install -r requirements_dev.txt
### Final image
FROM python:3.8-slim

ARG STATIC_URL
ENV STATIC_URL ${STATIC_URL:-/static/}

RUN groupadd -r saleor && useradd -r -g saleor saleor

RUN apt-get update \
Expand All @@ -33,16 +30,18 @@ RUN apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY . /app
RUN mkdir -p /app/media /app/static \
&& chown -R saleor:saleor /app/

COPY --from=build-python /usr/local/lib/python3.8/site-packages/ /usr/local/lib/python3.8/site-packages/
COPY --from=build-python /usr/local/bin/ /usr/local/bin/
COPY . /app
WORKDIR /app

ARG STATIC_URL
ENV STATIC_URL ${STATIC_URL:-/static/}
RUN SECRET_KEY=dummy STATIC_URL=${STATIC_URL} python3 manage.py collectstatic --no-input

RUN mkdir -p /app/media /app/static \
&& chown -R saleor:saleor /app/

EXPOSE 8000
ENV PORT 8000
ENV PYTHONUNBUFFERED 1
Expand Down

0 comments on commit 8dea48a

Please sign in to comment.