-
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.
Merge pull request #6 from ogrodnek/revert-5-optimize_docker
Revert "use docker build stage"
- Loading branch information
Showing
1 changed file
with
9 additions
and
13 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,22 +1,18 @@ | ||
# --- Build Stage --- | ||
FROM python:3.9-alpine AS builder | ||
FROM python:3.9-alpine | ||
|
||
# TODO don't need gcc on the final image, but need it for poetry install | ||
RUN apk add build-base libffi-dev | ||
|
||
|
||
RUN apk add --no-cache build-base libffi-dev | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
WORKDIR /app | ||
RUN pip3 install --no-cache-dir poetry | ||
|
||
RUN pip3 install poetry | ||
|
||
COPY . . | ||
|
||
WORKDIR /app/examples | ||
RUN poetry install --no-root --only main | ||
|
||
# --- Runtime Stage --- | ||
FROM python:3.9-alpine | ||
|
||
COPY --from=builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages | ||
COPY --from=builder /usr/local/bin /usr/local/bin | ||
COPY --from=builder /app /app | ||
|
||
|
||
WORKDIR /app/examples | ||
CMD [ "poetry", "run", "uvicorn", "--host", "0.0.0.0", "examples.app:app" ] |