mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-26 18:37:12 +00:00
Working docker devserver
This commit is contained in:
parent
09853ce990
commit
bf7b187048
16
Dockerfile
16
Dockerfile
@ -4,12 +4,12 @@ FROM debian:buster-backports
|
|||||||
ENV PYTHONUNBUFFERED 1
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
|
||||||
# Install Django, external apps, LaTeX and dependencies
|
# Install Django, external apps, LaTeX and dependencies
|
||||||
# Outside Docker, you may also need git, acl, python3-venv, uwsgi, uwsgi-plugin-python3, nginx
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -t buster-backports -y python3-django python3-django-crispy-forms \
|
apt-get install -t buster-backports -y python3-django python3-django-crispy-forms \
|
||||||
python3-django-extensions python3-django-filters python3-django-polymorphic \
|
python3-django-extensions python3-django-filters python3-django-polymorphic \
|
||||||
python3-djangorestframework python3-django-cas-server python3-psycopg2 python3-pil \
|
python3-djangorestframework python3-django-cas-server python3-psycopg2 python3-pil \
|
||||||
python3-babel python3-lockfile python3-pip \
|
python3-babel python3-lockfile python3-pip python3-phonenumbers ipython3 \
|
||||||
|
uwsgi uwsgi-plugin-python3 \
|
||||||
texlive-latex-extra texlive-fonts-extra texlive-lang-french \
|
texlive-latex-extra texlive-fonts-extra texlive-lang-french \
|
||||||
gettext libjs-bootstrap4 fonts-font-awesome && \
|
gettext libjs-bootstrap4 fonts-font-awesome && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
@ -22,15 +22,5 @@ RUN pip3 install -r /code/requirements.txt --no-cache-dir
|
|||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
COPY . /code/
|
COPY . /code/
|
||||||
|
|
||||||
#RUN pip install gunicorn ptpython --no-cache-dir
|
EXPOSE 8080
|
||||||
|
|
||||||
# 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_note.conf_docker /etc/nginx/conf.d/nginx_note.conf
|
|
||||||
RUN rm /etc/nginx/conf.d/default.conf
|
|
||||||
|
|
||||||
ENTRYPOINT ["/code/entrypoint.sh"]
|
ENTRYPOINT ["/code/entrypoint.sh"]
|
||||||
EXPOSE 80
|
|
||||||
|
|
||||||
CMD ["./manage.py", "shell_plus", "--ptpython"]
|
|
||||||
|
@ -11,14 +11,22 @@ else
|
|||||||
sed -i -e "s/REPLACEME/La Note Kfet \\\\ud83c\\\\udf7b/g" /code/note_kfet/fixtures/cas.json
|
sed -i -e "s/REPLACEME/La Note Kfet \\\\ud83c\\\\udf7b/g" /code/note_kfet/fixtures/cas.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
python manage.py compilemessages
|
# Set up Django project
|
||||||
python manage.py makemigrations
|
python3 manage.py collectstatic --noinput
|
||||||
python manage.py migrate
|
python3 manage.py compilemessages
|
||||||
|
python3 manage.py makemigrations
|
||||||
|
python3 manage.py migrate
|
||||||
|
|
||||||
nginx
|
if [ "$1" ]; then
|
||||||
|
# Command passed
|
||||||
if [ "$DJANGO_APP_STAGE" = "prod" ]; then
|
echo "Running $@..."
|
||||||
gunicorn -b 0.0.0.0:8000 --workers=2 --threads=4 --worker-class=gthread note_kfet.wsgi --access-logfile '-' --error-logfile '-';
|
$@
|
||||||
else
|
else
|
||||||
python manage.py runserver 0.0.0.0:8000;
|
# Launch server
|
||||||
|
if [ "$DJANGO_APP_STAGE" = "prod" ]; then
|
||||||
|
# FIXME: serve static files
|
||||||
|
uwsgi --http 0.0.0.0:8080 --master --module note_kfet.wsgi --processes 4
|
||||||
|
else
|
||||||
|
python3 manage.py runserver 0.0.0.0:8080;
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user