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/ !app/
!data/ !data/
!tests/ !tests/
!tools/
!requirements.txt !requirements.txt

4
.travis.yml

@ -4,6 +4,4 @@ python:
install: install:
- pip install -r requirements.txt - pip install -r requirements.txt
script: 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} FROM python:${PYTHON_VERSION}
COPY requirements.txt / 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 COPY . /doccano
WORKDIR /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 DEBUG="True"
ENV SECRET_KEY="change-me-in-production" 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