forked from mtnbarreto/flask-base-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
35 lines (26 loc) · 772 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
FROM python:3.8.2 as base
# set working directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# add requirements (to leverage Docker cache)
ADD ./requirements.txt /usr/src/app/requirements.txt
# install requirements
RUN pip install --no-cache-dir -r requirements.txt
# env variables
ENV FLASK_ENV="docker"
ENV FLASK_APP=project/__init__.py
# add app
ADD . /usr/src/app
# DEBUG image
FROM base as debug
# Debug image reusing the base
# Install dev dependencies for debugging
RUN pip install debugpy
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE 1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED 1
# PRODUCTION image
FROM base as prod
# run server
CMD gunicorn -b 0.0.0.0:5000 manage:app --reload