Merge pull request #127 from adamantike/fix/copy-dependencies-from-stage
Reduce Docker image size by only copying pip installed dependencies
This commit is contained in:
commit
9a295bbf91
11
Dockerfile
11
Dockerfile
@ -6,12 +6,13 @@ FROM python:alpine AS base
|
|||||||
FROM base AS dependencies
|
FROM base AS dependencies
|
||||||
# install dependencies
|
# install dependencies
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install --user -r requirements.txt
|
||||||
|
|
||||||
#
|
#
|
||||||
# ---- Release ----
|
# ---- Release ----
|
||||||
FROM dependencies AS release
|
FROM base AS release
|
||||||
# copy project source file(s)
|
# copy installed dependencies and project source file(s)
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
COPY --from=dependencies /root/.local /root/.local
|
||||||
COPY cloudflare-ddns.py .
|
COPY cloudflare-ddns.py .
|
||||||
CMD ["python", "-u", "/cloudflare-ddns.py", "--repeat"]
|
CMD ["python", "-u", "/cloudflare-ddns.py", "--repeat"]
|
||||||
|
|||||||
Reference in New Issue
Block a user