Skip to content

Commit

Permalink
Merge pull request #127 from adamantike/fix/copy-dependencies-from-stage
Browse files Browse the repository at this point in the history
Reduce Docker image size by only copying pip installed dependencies
  • Loading branch information
timothymiller authored Oct 12, 2023
2 parents fecf30c + 0ca6233 commit 9a295bb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ FROM python:alpine AS base
FROM base AS dependencies
# install dependencies
COPY requirements.txt .
RUN pip install -r requirements.txt
RUN pip install --user -r requirements.txt

#
# ---- Release ----
FROM dependencies AS release
# copy project source file(s)
FROM base AS release
# copy installed dependencies and project source file(s)
WORKDIR /
COPY --from=dependencies /root/.local /root/.local
COPY cloudflare-ddns.py .
CMD ["python", "-u", "/cloudflare-ddns.py", "--repeat"]
CMD ["python", "-u", "/cloudflare-ddns.py", "--repeat"]

0 comments on commit 9a295bb

Please sign in to comment.