-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
53 lines (37 loc) · 1.18 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
FROM python:3.9-slim as builder
ENV PYTHONPATH "${PYTHONPATH}:/app"
ENV PYTHONBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE 1
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
gcc \
build-essential \
libpq-dev
WORKDIR /app
RUN python -m venv venv
ENV PATH="/app/venv/bin:$PATH"
COPY requirements.txt .
RUN pip install wheel
# create and intall python wheels for dependencies
RUN pip wheel --wheel-dir=wheels -r requirements.txt
#########################################
FROM python:3.9-slim
WORKDIR /app
ENV PYTHONPATH "${PYTHONPATH}:/app"
ENV PYTHONBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE 1
RUN python -m venv venv
ENV PATH="/app/venv/bin:$PATH"
COPY requirements.txt .
RUN pip install wheel
COPY --from=builder /app/wheels /app/wheels
# install python wheels for dependencies
RUN pip install --no-index --find-links=/app/wheels -r requirements.txt
# COPY ./setup.py setup.py
COPY ./app app
COPY ./static/dist static/dist
EXPOSE 8000
RUN chown 1000:1000 /app
USER 1000
CMD [ "gunicorn", "-b", "0.0.0.0:8000", "-w", "2", "-k", "app.workers.UvicornWorker", "--access-logfile=-", "app.main:app"]
# CMD ["uvicorn", "--proxy-headers", "--host", "0.0.0.0", "--port", "8000", "app.main:app"]