max-pfeiffer / uvicorn-poetry

Docker image with Uvicorn ASGI server for running Python web applications on Kubernetes. Uses Poetry for managing dependencies and setting up a virtual environment. Supports AMD64 and ARM64 CPU architectures.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Curious about COPY here

rengler33 opened this issue · comments

Hey Max, I'm curious about the COPY choice here

FROM base-image as production-image

FROM base-image as production-image

COPY --from=base-image $VIRTUAL_ENVIRONMENT_PATH $VIRTUAL_ENVIRONMENT_PATH

Is there a reason to COPY --from=base-image when the image itself is built FROM base-image?

Hi Robert,
good point: I was already looking at this and wanted to optimise it the production-image in my next release. Here I wanted to do something like this:

FROM python:3.9.8-slim-bullseye as production-image

Reason is that you want your image to be as slim as possible. This way you leave out the Poetry installation that you don't need to have in your production image.
Regards, Max