-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
37 lines (25 loc) · 926 Bytes
/
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
FROM python:3.7.4
EXPOSE 5000
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends \
install build-essential
RUN apt-get update && \
apt-get install -y nginx supervisor;
# Setup flask application
RUN mkdir -p /deploy/app
COPY ./ /deploy/app
RUN pip install gunicorn
RUN pip install -r /deploy/app/requirements.txt
# Setup nginx
RUN rm /etc/nginx/sites-enabled/default && \
cp /deploy/app/flask.conf /etc/nginx/sites-available/ && \
ln -s /etc/nginx/sites-available/flask.conf /etc/nginx/sites-enabled/flask.conf && \
echo "daemon off;" >> /etc/nginx/nginx.conf;
# Setup supervisord
RUN mkdir -p /var/log/supervisor && \
cp /deploy/app/supervisord.conf /etc/supervisor/conf.d/supervisord.conf && \
cp /deploy/app/gunicorn.conf /etc/supervisor/conf.d/gunicorn.conf;
RUN apt-get clean;
WORKDIR /deploy/app
# run the application
CMD ["python", "/deploy/app/app.py"]