1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-04-25 11:32:37 +00:00

Add Docker build in CI

This commit is contained in:
Emmy D'Anello 2025-04-21 18:38:44 +02:00
parent 73b94d5578
commit 0a80e03b58
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -1,6 +1,12 @@
stages: stages:
- test - test
- quality-assurance - quality-assurance
- build
- release
variables:
CONTAINER_TEST_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
py312: py312:
stage: test stage: test
@ -27,3 +33,29 @@ linters:
- pip install tox --no-cache-dir - pip install tox --no-cache-dir
script: tox -e linters script: tox -e linters
allow_failure: true allow_failure: true
build-image:
image: docker
stage: build
services:
- docker:dind
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY -u $CI_REGISTRY_USER --password-stdin
script:
- docker build --pull -t $CONTAINER_TEST_IMAGE .
- docker push $CONTAINER_TEST_IMAGE
release-image:
image: docker
stage: release
services:
- docker:dind
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY -u $CI_REGISTRY_USER --password-stdin
script:
- docker pull $CONTAINER_TEST_IMAGE
- docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE
- docker push $CONTAINER_RELEASE_IMAGE
rules:
- if: $CI_COMMIT_BRANCH == "main"