Move to multi stage docker builds to reduce the image size
This commit is contained in:
parent
5858875f01
commit
02eae99833
15
Dockerfile
15
Dockerfile
@ -1,4 +1,4 @@
|
|||||||
FROM ubuntu:focal
|
FROM ubuntu:focal as build
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
python3 \
|
python3 \
|
||||||
@ -10,7 +10,18 @@ RUN python3 -m pip install "poetry==1.1.4"
|
|||||||
|
|
||||||
COPY . /app
|
COPY . /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
RUN poetry config virtualenvs.in-project true
|
||||||
RUN poetry install --no-dev
|
RUN poetry install --no-dev
|
||||||
|
|
||||||
ENTRYPOINT ["poetry","run", "uvicorn", "--proxy-headers", "--host", "0.0.0.0", "--port", "80", "app:app"]
|
FROM ubuntu:focal
|
||||||
|
|
||||||
|
COPY --from=build /app /app
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
python3 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
ENV PATH="/app/.venv/bin:$PATH"
|
||||||
|
ENTRYPOINT ["uvicorn", "--proxy-headers", "--host", "0.0.0.0", "--port", "80", "app:app"]
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user