-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (24 loc) · 1.04 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# https://fastapi.tiangolo.com/deployment/docker/#docker-image-with-poetry
FROM python:3.10-slim as requirements-stage
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
WORKDIR /tmp
RUN apt-get update && \
pip install --upgrade pip && \
pip install poetry==1.4 && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY ./poetry.lock* ./pyproject.toml /tmp/
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
FROM python:3.10-slim as build-stage
WORKDIR /src
# cv2 libgl1-mesa-glx: ImportError: libGL.so.1: cannot open shared object file: No such file or directory
# libgthread-2.0.so.0: cannot open shared object file
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential libgl1-mesa-glx libglib2.0-0 && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY --from=requirements-stage /tmp/requirements.txt /src/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /src/requirements.txt
EXPOSE 80
EXPOSE 443
COPY . /src/
CMD exec uvicorn --port $PORT --host 0.0.0.0 main:app