diff --git a/.gitignore b/.gitignore index b0eca735207437e3422031ec775cedc7dae40f15..8e87b3628b18bc7375d2a40d8f0b8bba22e0b6a5 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ report.sh /env .pytest_cache/ requirements.txt.old -**/node_modules \ No newline at end of file +**/node_modules +docker-compose.yml \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 429aede22a8632ce3ca1d4cf43951cac0df08fab..2057e8a3db18604ee28130630d04aa822584be2f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,17 +10,6 @@ stages: # List of stages for jobs, and their order of execution - build - deploy -build-python: - stage: test - script: - - python -m venv venv - - source venv/bin/activate - - pip install -r vapormap/app/requirements/production.txt - artifacts: - paths: - - venv - expire_in: 1 day - #Job de test de qualité de code Python de l'API lint_test_job: stage: test @@ -75,6 +64,18 @@ front_test_job: paths: - docs +docker_lint_job: + image: hadolint/hadolint:latest-alpine + script: + - rm -rf docs/docker/lint.md && touch docs/docker/lint.md + - echo "##Dockerfile.api" >> docs/docker/lint.md + - hadolint --no-color --no-fail Dockerfile.api | while read line; do echo ${line}" " >> docs/docker/lint.md; done + - echo "##Dockerfile.front" >> docs/docker/lint.md + - hadolint --no-color --no-fail Dockerfile.front | while read line; do echo ${line}" " >> docs/docker/lint.md; done + artifacts: + paths: + - docs + # Job de génération des pages pour le reporting des tests pages: stage: report @@ -86,6 +87,7 @@ pages: - job: e2e_test_job - job: cov_test_job - job: front_test_job + - job: docker_lint_job artifacts: paths: - public diff --git a/Dockerfile.api b/Dockerfile.api index 4aec24e1ca00ed147f544cb8fb7ad2849e1d3ed6..d3e99359e3a898d0adf968815aa6a4363cf7a8fc 100644 --- a/Dockerfile.api +++ b/Dockerfile.api @@ -2,7 +2,8 @@ FROM python:3.8-alpine WORKDIR /usr/src/app COPY vapormap/app . -RUN pip install --no-cache-dir -r requirements/production.txt +RUN pip install -r requirements/production.txt +RUN pip install flask ENTRYPOINT ["flask"] CMD ["run", "--host=0.0.0.0"] diff --git a/Dockerfile.front b/Dockerfile.front index f1f1fa28337c0afbd384404663be31de9eab3c0e..70c6f010df7cdfeffd5d15e87a4e5420329cc052 100644 --- a/Dockerfile.front +++ b/Dockerfile.front @@ -3,6 +3,4 @@ FROM nginx:1.23-alpine WORKDIR /usr/share/nginx/html COPY vapormap/frontend . -ENTRYPOINT ["nginx"] -CMD ["-g", "daemon off;"] EXPOSE 80 \ No newline at end of file diff --git a/README.md b/README.md index 801a394f62b10425c379569c85cba0bb29ffc1e2..95319c9598f39a560f684d8526a0ceda8b94e2ce 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,10 @@ pip install mkdocs-material==8.5.11 ## Lint Dockerfile +```sh docker run --rm -i hadolint/hadolint < Dockerfile +echo "##Dockerfile.api" >> docs/docker/docker.md && docker run --rm -i --env-file $PWD/hadolint.env hadolint/hadolint < Dockerfile.api | while read line; do echo ${line}" " >> docs/docker/docker.md; done +``` ## ENVSUBST @@ -42,3 +45,18 @@ flake8 api wsgi.py | while read line; do echo ${line}$" " >> docs/lint.md; done ./report.sh mkdocs build -d public ``` + +## Build venv job + +```sh +build-python: + stage: test + script: + - python -m venv venv + - source venv/bin/activate + - pip install -r vapormap/app/requirements/production.txt + artifacts: + paths: + - venv + expire_in: 1 day +``` diff --git a/docs/docker/.gitignore b/docs/docker/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/mkdocs.yml b/mkdocs.yml index 0b7183224286dc41f12fabbc0dc20444db69148d..7d71ceda1e2364922fa022bca12cdfc11b73dbdd 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -11,4 +11,5 @@ nav: - Tests Frontend: - Bootstrap HTML: frontend/bootlint.md - Javascript: frontend/jshint.md - - Style CSS: frontend/stylelint.md \ No newline at end of file + - Style CSS: frontend/stylelint.md + - Tests Dockerfiles: docker/lint.md \ No newline at end of file