-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
31 lines (28 loc) · 921 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
FROM python:2 AS builder
# Install the required python packages
WORKDIR /app/
# Copy flask app source code to the /app dir on the container
COPY app/ .
# Install the required python packages
RUN pip install \
--no-cache-dir \
-r dev-requirements.txt
FROM builder AS unit-tester
RUN py.test ./tests/unit -v \
--junitprefix=linux \
--junitxml unit_results.xml || true
FROM unit-tester AS integration-tester
RUN py.test ./tests/integration -v \
--junitprefix=linux \
--junitxml integration_results.xml || true
# Production image starts from the slimmer alpine container
FROM python:2-alpine AS production
WORKDIR /app/
# Copy flask app source code to the /app dir on the container
COPY app/ .
# Install only the production requirements, not dev packages
RUN pip install \
--no-cache-dir \
-r requirements.txt
# Start the calculator app when you run this container
CMD ["python", "calculator/app.py"]