Skip to content
Snippets Groups Projects
Commit 98811db5 authored by lucas.landrecy's avatar lucas.landrecy
Browse files

Update .gitlab-ci.yml file

parent 2b5a72d8
No related branches found
No related tags found
No related merge requests found
Pipeline #40539 failed
...@@ -4,34 +4,46 @@ stages: ...@@ -4,34 +4,46 @@ stages:
- deploy - deploy
variables: variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA DOCKER_DRIVER: overlay2
CLIENT_IMAGE: $CI_REGISTRY_IMAGE/client:$CI_COMMIT_SHORT_SHA
NEO4J_IMAGE: $CI_REGISTRY_IMAGE/neo4j:$CI_COMMIT_SHORT_SHA
# Docker build .default-docker-job:
build_image:
stage: build
image: docker:24.0 image: docker:24.0
services: services:
- docker:24.0-dind - docker:24.0-dind
script: before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build -t $IMAGE_TAG .
only:
- main
# Push to registry # Build both images
push_image: build_client:
extends: .default-docker-job
stage: build
script:
- docker build -t $CLIENT_IMAGE ./client
build_neo4j:
extends: .default-docker-job
stage: build
script:
- docker build -t $NEO4J_IMAGE ./neo4j
# Push both images
push_client:
extends: .default-docker-job
stage: push stage: push
image: docker:24.0
services:
- docker:24.0-dind
script: script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - docker push $CLIENT_IMAGE
- docker push $IMAGE_TAG needs: [build_client]
only:
- main push_neo4j:
needs: [build_image] extends: .default-docker-job
stage: push
script:
- docker push $NEO4J_IMAGE
needs: [build_neo4j]
# Deploy to Kubernetes (optional, requires kubectl config) # Optional deployment (e.g., via kubectl or Helm)
# deploy: # deploy:
# stage: deploy # stage: deploy
# image: # image:
...@@ -40,8 +52,8 @@ push_image: ...@@ -40,8 +52,8 @@ push_image:
# script: # script:
# - echo "$KUBECONFIG" > kubeconfig.yaml # - echo "$KUBECONFIG" > kubeconfig.yaml
# - export KUBECONFIG=$CI_PROJECT_DIR/kubeconfig.yaml # - export KUBECONFIG=$CI_PROJECT_DIR/kubeconfig.yaml
# - kubectl config get-contexts # - kubectl set image deployment/client client-container=$CLIENT_IMAGE --namespace=mon-namespace
# - kubectl set image deployment/mon-deploiement mon-container=$IMAGE_TAG --namespace=mon-namespace # - kubectl set image deployment/neo4j neo4j-container=$NEO4J_IMAGE --namespace=mon-namespace
# only: # only:
# - main # - main
# needs: [push_image] # needs: [push_client, push_neo4j]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment