Skip to content

Commit 9a295bb

Browse files
Merge pull request #127 from adamantike/fix/copy-dependencies-from-stage
Reduce Docker image size by only copying pip installed dependencies
2 parents fecf30c + 0ca6233 commit 9a295bb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ FROM python:alpine AS base
66
FROM base AS dependencies
77
# install dependencies
88
COPY requirements.txt .
9-
RUN pip install -r requirements.txt
10-
9+
RUN pip install --user -r requirements.txt
10+
1111
#
1212
# ---- Release ----
13-
FROM dependencies AS release
14-
# copy project source file(s)
13+
FROM base AS release
14+
# copy installed dependencies and project source file(s)
1515
WORKDIR /
16+
COPY --from=dependencies /root/.local /root/.local
1617
COPY cloudflare-ddns.py .
17-
CMD ["python", "-u", "/cloudflare-ddns.py", "--repeat"]
18+
CMD ["python", "-u", "/cloudflare-ddns.py", "--repeat"]

0 commit comments

Comments
 (0)