2020-09-20 20:31:37 +00:00
|
|
|
FROM python:3-alpine
|
2019-09-09 23:48:52 +00:00
|
|
|
|
2020-09-20 20:31:37 +00:00
|
|
|
ENV PYTHONUNBUFFERED 1
|
2020-09-22 17:37:37 +00:00
|
|
|
ENV DJANGO_ALLOW_ASYNC_UNSAFE 1
|
2019-09-09 23:48:52 +00:00
|
|
|
|
2020-09-20 20:31:37 +00:00
|
|
|
# Install LaTeX requirements
|
2020-10-09 11:49:09 +00:00
|
|
|
RUN apk add --no-cache gettext nginx gcc libc-dev libffi-dev libxml2-dev libxslt-dev postgresql-dev libmagic
|
2019-09-09 23:48:52 +00:00
|
|
|
|
2020-09-20 20:31:37 +00:00
|
|
|
RUN apk add --no-cache bash
|
2019-09-09 23:48:52 +00:00
|
|
|
|
2020-09-20 20:31:37 +00:00
|
|
|
RUN mkdir /code
|
|
|
|
WORKDIR /code
|
|
|
|
COPY requirements.txt /code/requirements.txt
|
2020-10-09 12:15:52 +00:00
|
|
|
RUN pip install -r requirements.txt psycopg2-binary sympasoap --no-cache-dir
|
2019-09-09 23:48:52 +00:00
|
|
|
|
2020-09-20 20:31:37 +00:00
|
|
|
COPY . /code/
|
2019-09-09 23:48:52 +00:00
|
|
|
|
2020-10-28 16:19:25 +00:00
|
|
|
RUN python manage.py collectstatic --noinput && \
|
|
|
|
python manage.py compilemessages && \
|
|
|
|
python manage.py migrate && \
|
|
|
|
python manage.py loaddata initial
|
|
|
|
|
2020-09-20 20:31:37 +00:00
|
|
|
# Configure nginx
|
|
|
|
RUN mkdir /run/nginx
|
|
|
|
RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log
|
|
|
|
RUN ln -sf /code/nginx_corres2math.conf /etc/nginx/conf.d/corres2math.conf
|
|
|
|
RUN rm /etc/nginx/conf.d/default.conf
|
2019-09-09 23:48:52 +00:00
|
|
|
|
2020-09-22 17:37:37 +00:00
|
|
|
RUN crontab /code/corres2math.cron
|
2019-09-09 23:48:52 +00:00
|
|
|
|
2020-09-20 20:31:37 +00:00
|
|
|
# With a bashrc, the shell is better
|
|
|
|
RUN ln -s /code/.bashrc /root/.bashrc
|
2019-09-12 14:01:40 +00:00
|
|
|
|
2020-09-20 20:31:37 +00:00
|
|
|
ENTRYPOINT ["/code/entrypoint.sh"]
|
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
CMD ["./manage.py", "shell_plus", "--ptpython"]
|