2020-04-15 21:00:04 +02:00
|
|
|
FROM python:3.8-alpine
|
|
|
|
WORKDIR /app
|
2020-04-20 18:56:29 +02:00
|
|
|
|
|
|
|
# set env
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE 1
|
|
|
|
ENV PYTHONUNBUFFERED 1
|
|
|
|
|
2020-05-01 21:40:43 +02:00
|
|
|
# https://github.com/twbs/bootstrap/issues/30553 don't upgrade jquery to 3.5.0 yet
|
|
|
|
ENV JQUERY_VERSION=3.4.1
|
|
|
|
ENV BOOTSTRAP_VERSION=4.4.1
|
|
|
|
ENV INTER_VERSION=3.13
|
|
|
|
|
2020-04-25 10:22:22 +02:00
|
|
|
# install required packages
|
|
|
|
RUN apk add --no-cache postgresql-dev gcc python3-dev musl-dev gettext postgresql-client nginx supervisor
|
2020-04-20 18:56:29 +02:00
|
|
|
|
|
|
|
# install dependencies
|
|
|
|
ADD ./requirements.txt .
|
2020-04-15 21:00:04 +02:00
|
|
|
RUN pip install -r requirements.txt
|
2020-04-20 18:56:29 +02:00
|
|
|
|
2020-04-25 10:22:22 +02:00
|
|
|
# add supervisor and nginx configs
|
|
|
|
ADD ./docker/nginx.conf /etc/nginx/nginx.conf
|
|
|
|
ADD ./docker/supervisord.conf /etc/supervisord.conf
|
|
|
|
|
2020-04-20 18:56:29 +02:00
|
|
|
# add user
|
|
|
|
RUN addgroup -S portier && adduser -S portier -G portier
|
|
|
|
|
|
|
|
# add code
|
|
|
|
ADD --chown=portier:portier . /app
|
2020-05-01 21:40:43 +02:00
|
|
|
|
|
|
|
# add static external libraries for frontend
|
|
|
|
ADD --chown=portier:portier http://code.jquery.com/jquery-${JQUERY_VERSION}.min.js /app/static/js/jquery.min.js
|
|
|
|
ADD --chown=portier:portier https://stackpath.bootstrapcdn.com/bootstrap/${BOOTSTRAP_VERSION}/js/bootstrap.bundle.min.js /app/static/js/bootstrap.bundle.min.js
|
|
|
|
RUN mkdir -p /tmp/inter /app/static/fonts \
|
|
|
|
&& cd /tmp/inter && wget https://github.com/rsms/inter/releases/download/v${INTER_VERSION}/Inter-${INTER_VERSION}.zip \
|
|
|
|
&& unzip Inter-${INTER_VERSION}.zip && mv /tmp/inter/Inter\ Web/* /app/static/fonts/ \
|
|
|
|
&& cd - \
|
|
|
|
&& rm -rf /tmp/inter \
|
|
|
|
&& chown -R portier:portier /app/static/fonts/
|
|
|
|
|
|
|
|
# collect static files and compile localized strings
|
2020-04-23 20:19:49 +02:00
|
|
|
RUN ./manage.py collectstatic --noinput --link
|
|
|
|
RUN ./manage.py compilemessages
|
|
|
|
|
2020-05-01 16:08:07 +02:00
|
|
|
CMD ["/app/start.sh"]
|