diff --git a/.dockerignore b/.dockerignore index 71ce7133..b693ba1b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,7 @@ * !app/ +app/staticfiles/ +app/db.sqlite3 !data/ !tests/ !tools/ diff --git a/.gitignore b/.gitignore index 7cc1ae8b..1ca8a1c4 100644 --- a/.gitignore +++ b/.gitignore @@ -195,4 +195,7 @@ pip-selfcheck.json /data/sparql/* # ignore db to avoid merge conflicts -*.sqlite3 \ No newline at end of file +*.sqlite3 + +# ignore django generated static files +app/staticfiles/ diff --git a/Dockerfile b/Dockerfile index 15dfa061..313abd72 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,5 +11,9 @@ WORKDIR /doccano ENV DEBUG="True" ENV SECRET_KEY="change-me-in-production" +ENV BIND="0.0.0.0:80" +ENV WORKERS="2" -CMD ["gunicorn", "--bind=0.0.0.0:80", "--workers=2", "--pythonpath=app", "app.wsgi"] +EXPOSE 80 + +CMD ["/doccano/tools/run.sh"] diff --git a/tools/run.sh b/tools/run.sh new file mode 100755 index 00000000..8c85df7c --- /dev/null +++ b/tools/run.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -o errexit + +if [[ ! -d "app/staticfiles" ]]; then python app/manage.py collectstatic --noinput; fi + +python app/manage.py migrate +gunicorn --bind="${BIND:-127.0.0.1:8000}" --workers="${WORKERS:-1}" --pythonpath=app app.wsgi