Merged staging/deployment configuration (Dockerfiles and CI config) into a branch derived from master.
This commit is contained in:
commit
87f65c84b0
5 changed files with 58 additions and 15 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -9,5 +9,5 @@
|
||||||
|
|
||||||
*.sqlite3
|
*.sqlite3
|
||||||
*.db
|
*.db
|
||||||
**/matemat.conf
|
|
||||||
static/upload/
|
static/upload/
|
||||||
|
**/matemat.conf
|
||||||
|
|
|
@ -1,20 +1,40 @@
|
||||||
---
|
---
|
||||||
image: s3lph/matemat-ci:20180619-01
|
image: s3lph/matemat-ci:20180711-02
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
- codestyle
|
- build
|
||||||
|
- staging
|
||||||
|
|
||||||
test:
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- pip3 install -r requirements.txt
|
- pip3 install -r requirements.txt
|
||||||
- python3-coverage run --branch -m unittest discover matemat
|
- sudo -u matemat python3-coverage run --branch -m unittest discover matemat
|
||||||
- python3-coverage report -m --include 'matemat/*' --omit '*/test_*.py'
|
- sudo -u matemat python3-coverage report -m --include 'matemat/*' --omit '*/test_*.py'
|
||||||
|
|
||||||
codestyle:
|
codestyle:
|
||||||
stage: codestyle
|
stage: test
|
||||||
script:
|
script:
|
||||||
- pip3 install -r requirements.txt
|
- pip3 install -r requirements.txt
|
||||||
- pycodestyle matemat
|
- sudo -u matemat pycodestyle matemat
|
||||||
# - mypy --ignore-missing-imports --strict -p matemat
|
# - sudo -u matemat mypy --ignore-missing-imports --strict -p matemat
|
||||||
|
|
||||||
|
build:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- docker build -t "registry.gitlab.com/s3lph/matemat:$(git rev-parse HEAD)" .
|
||||||
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_TOKEN registry.gitlab.com
|
||||||
|
- docker push "registry.gitlab.com/s3lph/matemat:$(git rev-parse HEAD)"
|
||||||
|
|
||||||
|
staging:
|
||||||
|
stage: staging
|
||||||
|
script:
|
||||||
|
- eval $(ssh-agent -s)
|
||||||
|
- ssh-add - <<<"$STAGING_SSH_PRIVATE_KEY"
|
||||||
|
- echo "$(git rev-parse HEAD)" | ssh -p 20022 -oStrictHostKeyChecking=no matemat@kernelpanic.lol
|
||||||
|
environment:
|
||||||
|
name: staging
|
||||||
|
url: https://matemat.kernelpanic.lol/
|
||||||
|
only:
|
||||||
|
- /^staging-.*$/
|
||||||
|
|
13
Dockerfile
13
Dockerfile
|
@ -1,10 +1,9 @@
|
||||||
|
|
||||||
FROM debian:buster
|
FROM python:3.6-alpine
|
||||||
|
|
||||||
RUN useradd -d /home/matemat -m matemat
|
RUN mkdir -p /var/matemat/db /var/matemat/upload
|
||||||
RUN apt-get update -qy
|
ADD . /
|
||||||
RUN apt-get install -y --no-install-recommends python3-dev python3-pip python3-coverage python3-setuptools build-essential
|
RUN pip3 install -r /requirements.txt
|
||||||
RUN pip3 install wheel pycodestyle mypy
|
|
||||||
|
|
||||||
WORKDIR /home/matemat
|
EXPOSE 80/tcp
|
||||||
USER matemat
|
CMD [ "/usr/local/bin/python3", "-m", "matemat", "/etc/matemat.conf", "/matemat.docker.conf" ]
|
||||||
|
|
13
matemat.docker.conf
Normal file
13
matemat.docker.conf
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
[Matemat]
|
||||||
|
|
||||||
|
Address=::
|
||||||
|
Port=80
|
||||||
|
|
||||||
|
StaticPath=/static
|
||||||
|
TemplatePath=/templates
|
||||||
|
|
||||||
|
LogTarget=stdout
|
||||||
|
|
||||||
|
[Pagelets]
|
||||||
|
UploadDir=/static/upload
|
||||||
|
DatabaseFile=/var/matemat/db/test.db
|
11
testing/Dockerfile
Normal file
11
testing/Dockerfile
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
FROM debian:buster
|
||||||
|
|
||||||
|
RUN useradd -d /home/matemat -m matemat
|
||||||
|
RUN mkdir -p /var/matemat/db && chown matemat:matemat -R /var/matemat/db
|
||||||
|
RUN mkdir -p /var/matemat/upload && chown matemat:matemat -R /var/matemat/upload
|
||||||
|
RUN apt-get update -qy
|
||||||
|
RUN apt-get install -y --no-install-recommends sudo openssh-client git docker.io python3-dev python3-pip python3-coverage python3-setuptools build-essential
|
||||||
|
RUN pip3 install wheel pycodestyle mypy
|
||||||
|
|
||||||
|
WORKDIR /home/matemat
|
Loading…
Reference in a new issue