-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (27 loc) · 974 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
FROM python:alpine as python-base
MAINTAINER Denys Zarubin
LABEL test_image=true
WORKDIR /django
COPY requirements requirements
# Cache this
RUN apk add -U postgresql-dev build-base linux-headers && \
pip install -r /django/requirements/common.txt && \
pip install -r /django/requirements/test.txt
# Run tests for new code
COPY . /django
RUN python -m pytest tests --ds=settings.test --cov-report=xml --junitxml=/django/pytest.xml && \
prospector --path=. --profile=/django/prospector.yml
FROM python:alpine
WORKDIR /django
COPY --from=python-base /root/.cache /root/.cache
COPY --from=python-base /django/requirements requirements
# Cache this
RUN apk add -U postgresql-dev build-base linux-headers && \
pip install -r /django/requirements/common.txt && \
rm -rf /root/.cache && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/*
# Run copy code
COPY --from=python-base /django/ .
EXPOSE 8000
ENTRYPOINT ["/django/entrypoint.sh"]
CMD ["prod"]