forked from DefectDojo/django-DefectDojo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.nginx
72 lines (65 loc) · 2.02 KB
/
Dockerfile.nginx
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# code: language=Dockerfile
# The code for the build image should be idendical with the code in
# Dockerfile.django to use the caching mechanism of Docker.
FROM python:3.5.7-buster@sha256:4598d4365bb7a8628ba840f87406323e699c4da01ae6f926ff33787c63230779 as build
WORKDIR /app
RUN \
apt-get -y update && \
apt-get -y install \
dnsutils \
default-mysql-client \
postgresql-client \
xmlsec1 \
git \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists && \
true
COPY requirements.txt ./
RUN pip3 wheel --wheel-dir=/tmp/wheels -r ./requirements.txt
FROM build AS collectstatic
USER root
RUN \
apt-get -y update && \
apt-get -y install apt-transport-https ca-certificates && \
curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
echo "deb https://deb.nodesource.com/node_11.x stretch main" | tee /etc/apt/sources.list.d/nodesource.list && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get -y update && \
apt-get -y install nodejs && \
apt-get -y install --no-install-recommends yarn && \
apt-get clean && \
rm -rf /var/lib/apt/lists && \
true
RUN pip3 install \
--no-cache-dir \
--no-index \
--find-links=/tmp/wheels \
-r ./requirements.txt
COPY components/ ./components/
COPY manage.py ./
COPY dojo/ ./dojo/
RUN \
cp dojo/settings/settings.dist.py dojo/settings/settings.py
RUN \
cd components && \
yarn && \
cd .. && \
python3 manage.py collectstatic --noinput && \
true
FROM nginx:1.17.2@sha256:eb3320e2f9ca409b7c0aa71aea3cf7ce7d018f03a372564dbdb023646958770b
COPY --from=collectstatic /app/static/ /usr/share/nginx/html/static/
COPY wsgi_params nginx/nginx.conf /etc/nginx/
COPY docker/entrypoint-nginx.sh /
RUN \
chmod -R g=u /var/cache/nginx && \
chmod -R g=u /var/run && \
true
ENV \
DD_UWSGI_PASS="uwsgi_server" \
DD_UWSGI_HOST="uwsgi" \
DD_UWSGI_PORT="3031"
USER 1001
EXPOSE 8080
ENTRYPOINT ["/entrypoint-nginx.sh"]