-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
64 lines (44 loc) · 1.83 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
# Python DEPS
FROM python:3.8-slim as python-base
ADD requirements.txt .
RUN apt-get update -y \
&& apt-get install -y libssl-dev libxml2-dev libxslt1-dev libxmlsec1-openssl gcc pkg-config \
&& apt-get install -y --no-install-recommends --no-install-suggests libxmlsec1-dev libz-dev \
&& pip install -r requirements.txt \
&& pip install uwsgi
# NODE DEPS
FROM node:16 as node-deps
WORKDIR /home/node/app
COPY package.json package-lock.json bower.json gulpfile.js /home/node/app/
COPY compair/static/ /home/node/app/compair/static/
RUN mkdir -p compair/templates/static/ \
&& npm install --production --no-optional \
&& node_modules/gulp/bin/gulp.js \
&& node_modules/gulp/bin/gulp.js prod
# Python Application image
FROM python:3.8-slim as python-app
MAINTAINER Pan Luo <[email protected]>
ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH /code
ENV DEV 0
WORKDIR /code
COPY --from=python-base /root/.cache /root/.cache
COPY --from=python-base /requirements.txt /code/requirements.txt
RUN apt-get update -y \
&& apt-get install -y libssl-dev libxml2-dev libxslt1-dev libxmlsec1-openssl \
&& apt-get install -y --no-install-recommends --no-install-suggests libxmlsec1-dev libz-dev \
&& pip install -r /code/requirements.txt \
&& pip install uwsgi \
&& rm -rf /root/.cache \
&& rm -rf /var/lib/apt/lists/*
# Copy the base uWSGI ini file to enable default dynamic uwsgi process number
COPY deploy/docker/uwsgi.ini /etc/uwsgi/
COPY deploy/docker/docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
ADD . /code/
# overrite static files from node built deps
COPY --from=node-deps /home/node/app/compair/static/ /code/compair/static/
COPY --from=node-deps /home/node/app/compair/templates/static/ /code/compair/templates/static/
VOLUME ["/code/persistent"]
EXPOSE 3031
CMD ["uwsgi", "--ini", "/etc/uwsgi/uwsgi.ini"]