-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (37 loc) · 1.26 KB
/
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
38
39
40
41
42
# Phase I - Builder source
FROM python:latest as builder
# PYTHONUNBUFFERED Force logging to stdout / stderr not to be buffered into ram
ENV PYTHONNUNBUFFERED=1
WORKDIR /usr/src/app
COPY /app ./
WORKDIR /wheels
COPY app/requirements.txt ./
RUN pip wheel -r ./requirements.txt
# Phase II - Linting the code
FROM eeacms/pylint:latest as linting
WORKDIR /code
COPY --from=builder /usr/src/app/pylint.cfg /etc/pylint.cfg
COPY --from=builder /usr/src/app/*.py ./
RUN ["/docker-entrypoint.sh", "pylint"]
# Phase IV - Unit testing
#FROM python:latest as unit-tests
#WORKDIR /usr/src/app
#Copy all packages instead of rerunning pip install
#COPY --from=builder /wheels /wheels
#RUN pip install -r /wheels/requirements.txt \
# -f /wheels \
# && rm -rf /wheels \
# && rm -rf /root/.cache/pip/*
#COPY --from=builder /usr/src/app/ ./
#RUN ["make", "test"]
# Phase V - running the script itself
FROM python:3.8-slim as serve
WORKDIR /usr/src/app
# Copy all packages instead of rerunning pip install
COPY --from=builder /wheels /wheels
RUN pip install -r /wheels/requirements.txt \
-f /wheels \
&& rm -rf /wheels \
&& rm -rf /root/.cache/pip/*
COPY --from=builder /usr/src/app/*.py ./
CMD ["python", "aws-call.py"]