Browse Source

Share CI steps between Docker and Travis

pull/68/head
Clemens Wolff 5 years ago
parent
commit
c8e5f9b746
4 changed files with 11 additions and 10 deletions
  1. 1
      .dockerignore
  2. 4
      .travis.yml
  3. 9
      Dockerfile
  4. 7
      tools/ci.sh

1
.dockerignore

@ -2,4 +2,5 @@
!app/
!data/
!tests/
!tools/
!requirements.txt

4
.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

9
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"]

7
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
Loading…
Cancel
Save