Skip to content

Commit

Permalink
take 2 on slimming down example image
Browse files Browse the repository at this point in the history
  • Loading branch information
ogrodnek committed Mar 29, 2024
1 parent 9c94072 commit 1ee6628
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions Dockerfile
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" ]

0 comments on commit 1ee6628

Please sign in to comment.