forked from fsinfuhh/Bitpoll
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
executable file
·68 lines (44 loc) · 1.75 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
#sentry-cli releases -o sentry-internal new -p bitpoll $VERSION
# Dockerfile
FROM python: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
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 uwsgi
FROM dependencies as collect-static
#TODO: replace with linked files or Path/LD/Python ENV variables
RUN cp -r /install/* /usr/local
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
RUN 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