From c8e5f9b7461447f773da455db347033732ea65b8 Mon Sep 17 00:00:00 2001 From: Clemens Wolff Date: Thu, 24 Jan 2019 08:25:27 -0500 Subject: [PATCH] Share CI steps between Docker and Travis --- .dockerignore | 1 + .travis.yml | 4 +--- Dockerfile | 9 ++------- tools/ci.sh | 7 +++++++ 4 files changed, 11 insertions(+), 10 deletions(-) create mode 100755 tools/ci.sh diff --git a/.dockerignore b/.dockerignore index bb1fa14b..71ce7133 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,4 +2,5 @@ !app/ !data/ !tests/ +!tools/ !requirements.txt diff --git a/.travis.yml b/.travis.yml index c3ba895a..d13a65d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,4 @@ python: install: - pip install -r requirements.txt script: - - python app/manage.py migrate - - python app/manage.py collectstatic - - python app/manage.py test server.tests + - tools/ci.sh diff --git a/Dockerfile b/Dockerfile index ce3c0b9a..15dfa061 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,18 +3,13 @@ ARG PYTHON_VERSION="3.6" FROM python:${PYTHON_VERSION} COPY requirements.txt / -RUN python -m venv /venv \ - && /venv/bin/pip install --no-cache-dir -r /requirements.txt +RUN pip install --no-cache-dir -r /requirements.txt COPY . /doccano WORKDIR /doccano -RUN ["/venv/bin/python", "app/manage.py", "migrate"] -RUN ["/venv/bin/python", "app/manage.py", "collectstatic"] -RUN ["/venv/bin/python", "app/manage.py", "test", "server.tests"] - ENV DEBUG="True" ENV SECRET_KEY="change-me-in-production" -CMD ["/venv/bin/gunicorn", "--bind=0.0.0.0:80", "--workers=2", "--pythonpath=app", "app.wsgi"] +CMD ["gunicorn", "--bind=0.0.0.0:80", "--workers=2", "--pythonpath=app", "app.wsgi"] diff --git a/tools/ci.sh b/tools/ci.sh new file mode 100755 index 00000000..5bdb9590 --- /dev/null +++ b/tools/ci.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -o errexit + +python app/manage.py migrate +python app/manage.py collectstatic +python app/manage.py test server.tests