Merge branch 'deployment-to-master' into 'master'
Improved CI Pipeline and Dockerfiles Closes #8 See merge request s3lph/matemat!17
This commit is contained in:
commit
e11205c36d
6 changed files with 63 additions and 16 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,44 @@
|
||||||
---
|
---
|
||||||
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 tag "registry.gitlab.com/s3lph/matemat:$(git rev-parse HEAD)" registry.gitlab.com/s3lph/matemat:latest-staging
|
||||||
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_TOKEN registry.gitlab.com
|
||||||
|
- docker push "registry.gitlab.com/s3lph/matemat:$(git rev-parse HEAD)"
|
||||||
|
- docker push registry.gitlab.com/s3lph/matemat:latest-staging
|
||||||
|
only:
|
||||||
|
- /^staging-.*$/
|
||||||
|
|
||||||
|
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" ]
|
||||||
|
|
2
doc
2
doc
|
@ -1 +1 @@
|
||||||
Subproject commit c68df9d86af1d8d0ebb6b6609efeef14f7103761
|
Subproject commit 92e168a288b396a7a97d200b80affdf8690bd03d
|
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