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:
Timothy Miller 2023-10-12 02:15:43 -04:00 committed by GitHub
commit 9a295bbf91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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"]