-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (28 loc) · 1022 Bytes
/
Dockerfile
File metadata and controls
38 lines (28 loc) · 1022 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
35
36
37
38
FROM python:3.7-slim AS builder
LABEL Name="Subscriber Version=0.1.0"
# Keep Python from generating .pyc files in the container and
# turn off buffering for easier container logging
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
EXPOSE 5000
COPY requirements/ /opt/subscriber/requirements
COPY ./subscriber/ /opt/subscriber
COPY ./.env /opt
COPY ./run.py /opt
WORKDIR /opt
# ============ PRODUCTION ENV ============
FROM builder AS production
RUN python -m pip install -r /opt/subscriber/requirements/prod.txt
CMD /bin/bash -c "python run.py"
# TODO: Add Gunicorn: gunicorn --bind 0.0.0.0:5000 run:app
# ============ TESTING ENV ============
FROM builder AS testing
COPY ./tests /opt/tests
COPY ./test.sh /opt
RUN python -m pip install -r /opt/subscriber/requirements/test.txt
CMD ["./test.sh"]
# ============ DEVELOPMENT ENV ============
FROM builder AS development
COPY ./tests /opt/tests
RUN python -m pip install -r /opt/subscriber/requirements/dev.txt
CMD /bin/bash -c "python run.py"