forked from helfertool/helfertool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (46 loc) · 2.25 KB
/
Copy pathDockerfile
File metadata and controls
54 lines (46 loc) · 2.25 KB
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
FROM debian:bookworm
ARG CONTAINER_VERSION="unknown"
ENV LANG=C.UTF-8
ENV DJANGO_SETTINGS_MODULE="helfertool.settings_container"
ENV HELFERTOOL_CONFIG_FILE="/config/helfertool.yaml"
RUN apt update && apt upgrade && apt-get install --no-install-recommends -y \
supervisor pkg-config nginx rsyslog pwgen curl \
python3 python3-pip python3-dev uwsgi uwsgi-plugin-python3 \
build-essential libldap2-dev libsasl2-dev libmariadb-dev libmagic1 \
texlive-latex-extra texlive-plain-generic texlive-fonts-recommended texlive-lang-german && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /usr/share/doc/* && \
# add user, some directories and set file permissions
useradd --shell /bin/bash --home-dir /helfertool --create-home helfertool --uid 10001 && \
mkdir -p /config /data /log /helfertool/run && \
chmod -R 0777 /helfertool/run && \
# nginx always writes to /var/log/nginx/error.log before reading the config
# so we redirect it to a writable location
rm /var/log/nginx/error.log && \
ln -s /helfertool/run/nginx/error.log /var/log/nginx/error.log && \
# we should have a writable /tmp, some tools expect this
rm -rf /tmp && \
ln -s /helfertool/run/tmp /tmp
COPY src /helfertool/src
COPY deployment/container/etc /helfertool/etc
COPY deployment/container/helfertool.sh /usr/local/bin/helfertool
COPY deployment/container/healthcheck.sh /usr/local/bin/healthcheck
RUN echo $CONTAINER_VERSION > /helfertool/container_version && \
# install python libs
cd /helfertool/src/ && \
pip3 install -U pip && \
pip3 install -r requirements.txt -r requirements_prod.txt && \
rm -rf /root/.cache/pip/ && \
# generate compressed CSS/JS files
HELFERTOOL_CONFIG_FILE=/dev/null python3 manage.py compress --force && \
# copy static files
HELFERTOOL_CONFIG_FILE=/dev/null python3 manage.py collectstatic --noinput && \
chmod -R go+rX /helfertool/static && \
# fix permissions
chmod +x /usr/local/bin/helfertool /usr/local/bin/healthcheck
VOLUME ["/config", "/data", "/log", "/helfertool/run"]
EXPOSE 8000
USER helfertool
ENTRYPOINT ["/usr/local/bin/helfertool"]
CMD ["run"]
HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 CMD ["/usr/local/bin/healthcheck"]