-
Notifications
You must be signed in to change notification settings - Fork 38
/
Dockerfile
executable file
·70 lines (45 loc) · 2 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
#sentry-cli releases -o sentry-internal new -p bitpoll $VERSION
# Dockerfile
FROM python:3.11-slim as common-base
#ENV DJANGO_SETTINGS_MODULE foo.settings
ENV UID=2008
RUN usermod -u $UID -g nogroup -d /opt/bitpoll www-data
RUN mkdir -p /opt/bitpoll
WORKDIR /opt/bitpoll
RUN apt update && apt install -y --no-install-recommends libldap-2.5-0 libsasl2-2 uwsgi uwsgi-plugin-python3 && rm -rf /var/lib/apt/lists/*
FROM common-base as base-builder
RUN pip install -U pip setuptools
FROM base-builder as dependencies
RUN apt-get update && apt-get -y --no-install-recommends install g++ wget python3-pip make gettext gcc python3-dev libldap2-dev gpg gpg-agent curl libsasl2-dev npm
COPY requirements-production.txt .
RUN pip install --no-warn-script-location --prefix=/install -U -r requirements-production.txt
FROM dependencies as collect-static
RUN npm install cssmin uglify-js -g
COPY manage.py .
COPY bitpoll bitpoll
COPY locale locale
COPY docker_files/config/settings.py bitpoll/settings_local.py
# Set Pythonpath tro the packages installed with pip bevore so they are aviable in this step
RUN export PYTHONPATH=/install/lib/python$(python3 --version | cut -d ' ' -f 2 | cut -d '.' -f 1,2)/site-packages && \
python3 /opt/bitpoll/manage.py collectstatic --noinput && \
python3 manage.py compilemessages &&\
rm bitpoll/settings_local.py
FROM common-base
#RUN apt-get -y --no-install-recommends install python3-psycopg2 python3-ldap3 gettext
COPY --from=dependencies /install /usr/local
COPY --from=collect-static /opt/bitpoll .
COPY docker_files/run /usr/local/bin
COPY docker_files/uwsgi-bitpoll.ini /etc/uwsgi/bitpoll.ini
RUN chown $UID -R _static
RUN chmod o+r -R .
RUN ln -sf /opt/config/settings.py /opt/bitpoll/bitpoll/settings_local.py
RUN ln -sf /opt/storage/media /opt/bitpoll/_media
ARG RELEASE_VERSION=2022.05.22
RUN echo $RELEASE_VERSION > /opt/bitpoll/.releaseversion
ENV LANG=C.UTF-8
EXPOSE 3008/tcp
EXPOSE 3009/tcp
VOLUME /opt/static
VOLUME /opt/config
VOLUME /opt/log
ENTRYPOINT /usr/local/bin/run