-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
take 2 on slimming down example image
- Loading branch information
Showing
1 changed file
with
16 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
FROM python:3.9-alpine | ||
FROM python:3.11-alpine as build | ||
|
||
# TODO don't need gcc on the final image, but need it for poetry install | ||
RUN apk add build-base libffi-dev | ||
RUN pip install poetry | ||
ENV POETRY_NO_INTERACTION=1 \ | ||
POETRY_VIRTUALENVS_IN_PROJECT=1 \ | ||
POETRY_VIRTUALENVS_CREATE=1 \ | ||
PYTHONUNBUFFERED=1 | ||
|
||
|
||
ENV PYTHONUNBUFFERED 1 | ||
|
||
WORKDIR /app | ||
COPY . . | ||
|
||
WORKDIR /app/examples | ||
RUN poetry install --no-root --only main --no-cache | ||
|
||
RUN pip3 install poetry | ||
FROM python:3.11-alpine as runtime | ||
|
||
COPY . . | ||
ENV VIRTUAL_ENV=/app/examples/.venv \ | ||
PATH="/app/examples/.venv/bin:$PATH" | ||
|
||
COPY --from=build /app /app | ||
|
||
WORKDIR /app/examples | ||
RUN poetry install --no-root --only main | ||
|
||
CMD [ "poetry", "run", "uvicorn", "--host", "0.0.0.0", "examples.app:app" ] | ||
CMD [ "uvicorn", "--host", "0.0.0.0", "examples.app:app" ] |