forked from uktrade/data-workspace-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
100 lines (78 loc) · 2.29 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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
FROM debian:bullseye-20220509-slim AS base
ENV \
LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8 \
PYTHONPATH=/dataworkspace \
DJANGO_SETTINGS_MODULE=dataworkspace.settings.base
RUN apt-get update && \
apt-get update && \
apt-get install -y --no-install-recommends curl bzip2 make ca-certificates && \
curl https://ftp.gnu.org/gnu/parallel/parallel-20190522.tar.bz2 > parallel-20190522.tar.bz2 && \
tar xjf parallel-20190522.tar.bz2 && \
cd parallel-20190522 && \
./configure && make && make install && \
cd / && \
rm -rf parallel-20190522 parallel-20190522.tar.bz2 && \
apt-get install -y --no-install-recommends \
locales \
git \
nginx \
nginx-extras \
openssl \
build-essential \
libpq-dev \
procps \
python3 \
python3-dev \
python3-pip \
python3-setuptools && \
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
locale-gen en_US.utf8 && \
rm /etc/nginx/nginx.conf && \
rm -rf /tmp/* && \
rm -rf /var/lib/apt/lists/* && \
useradd -m django && \
chown -R django /var/log/nginx
COPY requirements.txt requirements.txt
RUN python3 -m pip install --upgrade pip wheel && \
python3 -m pip install -r requirements.txt
FROM base AS test
RUN apt-get update && \
apt-get install -y --no-install-recommends \
gcc \
musl-dev \
chromium \
chromium-driver \
libxml2-dev \
libxslt1-dev && \
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
locale-gen en_US.utf8 && \
rm -rf /tmp/* && \
rm -rf /var/lib/apt/lists/*
COPY requirements-dev.txt requirements-dev.txt
COPY setup.cfg setup.cfg
RUN pip3 install -r requirements-dev.txt
COPY dataworkspace /dataworkspace
RUN cd dataworkspace
COPY etc /etc
RUN \
mkdir /test-results && \
chown -R django:django /test-results
USER django
COPY test /test
FROM test as dev
USER root
RUN apt-get update && \
apt-get install -y --no-install-recommends nodejs npm && \
rm -rf /tmp/* && \
rm -rf /var/lib/apt/lists/*
RUN npm install --global --unsafe-perm nodemon
USER django
CMD ["/dataworkspace/start-dev.sh"]
FROM base AS live
COPY dataworkspace /dataworkspace
RUN cd dataworkspace
COPY etc /etc
CMD ["/dataworkspace/start.sh"]
USER django