diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dcc7891582be1a453a89a7589d4d5ea7e779c045..64f48a178a83f7c9cfc043fd70a3ec9e37133cdb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,16 +1,37 @@ image: python:3-buster -before_script: - - pip install -r requirements-dev.txt +stages: + - test + - build + analyze: + stage: test + before_script: + - pip install -r requirements-dev.txt script: - - bandit whatformat/*.py whatformat/util/*.py - - flake8 --config=.flake8 whatformat/*.py whatformat/util/*.py - - mypy whatformat/*.py whatformat/util/*.py - - pydocstyle whatformat/*.py whatformat/util/*.py - - pylint whatformat/*.py whatformat/util/*.py + - bandit whatformat/*.py whatformat/util/*.py + - flake8 --config=.flake8 whatformat/*.py whatformat/util/*.py + - mypy whatformat/*.py whatformat/util/*.py + - pydocstyle whatformat/*.py whatformat/util/*.py + - pylint whatformat/*.py whatformat/util/*.py test: + stage: test + before_script: + - pip install -r requirements-dev.txt script: - - python3 -m unittest + - python3 -m unittest + +build_image: + stage: build + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + variables: + IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG + script: + - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json + - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG + only: + - tags diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..f3356b12ac41cc132b7692c3c00a85c8c8c20c48 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3-buster +WORKDIR /opt/whatformat + +COPY / /opt/whatformat +RUN pip install -r /opt/whatformat/requirements.txt + +CMD gunicorn -w 4 -b 0.0.0.0:80 whatformat.app:app + +EXPOSE 80/tcp diff --git a/requirements.txt b/requirements.txt index 4352144b61f56010ac9170c73d2b632921b7d3aa..2b1f4ac29e2d0d58d7c993ac1b4eed58b569c41c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ python-dateutil==2.8.1 Flask==1.1.1 Flask-Caching==1.8.0 +gunicorn==20.0.4