-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
75 lines (53 loc) · 2.38 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
FROM node:14-buster-slim AS builder
LABEL maintainer="Pouria Hadjibagheri <[email protected]>"
WORKDIR /app/static
COPY ./app/assets /app/static
RUN rm -rf node_modules
RUN npm install
RUN npm rebuild node-sass
RUN npm run build /app/static
RUN rm -rf node_modules
FROM python:3.9-buster
ENV NUMEXPR_MAX_THREADS 1
COPY server/install-nginx.sh /install-nginx.sh
RUN bash /install-nginx.sh
RUN rm /etc/nginx/conf.d/default.conf
# Install Supervisord
RUN apt-get update && \
apt-get upgrade -y --no-install-recommends && \
apt-get install -y supervisor openssh-server && \
echo "root:Docker!" | chpasswd && \
rm -rf /var/lib/apt/lists/*
WORKDIR /opt
COPY requirements.txt ./config/requirements.txt
RUN apt update && \
pip3 install -r /opt/config/requirements.txt && \
apt remove -y python3-pip && \
apt autoremove --purge -y && \
rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/*.list && \
rm -rf /opt/config/requirements.txt
COPY --from=builder /app/static/dist /opt/assets
COPY app/assets/images /opt/assets/images
COPY app/assets/icon /opt/assets/icon
COPY app/assets/govuk-frontend /opt/assets/govuk-frontend
COPY app/assets/images/opengraph-image.png /opt/assets/public/images/opengraph-image.png
COPY ./app /opt/app
# Gunicorn config
COPY server/gunicorn_conf.py /opt/gunicorn_conf.py
COPY server/supervisord.conf /opt/supervisor/supervisord.conf
# Main service entrypoint - launches supervisord
COPY server/start-gunicorn.sh /opt/start-gunicorn.sh
COPY server/entrypoint.sh /opt/entrypoint.sh
RUN chmod +x /opt/entrypoint.sh
RUN chmod +x /opt/start-gunicorn.sh
COPY server/base.nginx /etc/nginx/nginx.conf
COPY server/engine.nginx /etc/nginx/conf.d/engine.conf
RUN mkdir -p /opt/log && \
mkdir -p /opt/nginx && \
mkdir -p /opt/nginx/cache && \
mkdir -p /opt/supervisor/ && \
mkdir -p /run/sshd
ENV PYTHONPATH /opt/
COPY /server/sshd_config /etc/ssh/
EXPOSE 5100 2222
ENTRYPOINT ["./entrypoint.sh"]