-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (22 loc) · 738 Bytes
/
Dockerfile
File metadata and controls
34 lines (22 loc) · 738 Bytes
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
FROM python:3.9.5-slim-buster as base
LABEL maintainer "Andrew Bilenduke <andrewbilenduke@gmail.com>"
RUN apt-get update
ENV APP_ROOT="/var/www/flask_backend"
ENV FLASK_APP="${APP_ROOT}/wsgi.py"
WORKDIR ${APP_ROOT}
COPY ./requirements.txt ./requirements.txt
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 5000
# DEBUG BUILD
FROM base as development
RUN pip install debugpy
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
EXPOSE 5678
CMD [ "python", "-m", "debugpy", "--listen", "0.0.0.0:5678", "-m", "flask", "run", "-h", "0.0.0.0", "-p", "5000" ]
# PRODUCTION BUILD
FROM base as production
RUN pip install gunicorn
COPY . .
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "wsgi:app"]