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

Update .gitlab-ci.yml file

parent 787f30a0
No related branches found
No related tags found
No related merge requests found
Pipeline #40520 failed
stages:
- build
- push
- deploy
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
# Docker build
build_image:
stage: build
image: docker:24.0
services:
- docker:24.0-dind
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build -t $IMAGE_TAG .
only:
- main
# Push to registry
push_image:
stage: push
image: docker:24.0
services:
- docker:24.0-dind
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker push $IMAGE_TAG
only:
- main
needs: [build_image]
# Deploy to Kubernetes (optional, requires kubectl config)
# deploy:
# stage: deploy
# image:
# name: bitnami/kubectl:latest
# entrypoint: [""]
# script:
# - echo "$KUBECONFIG" > kubeconfig.yaml
# - export KUBECONFIG=$CI_PROJECT_DIR/kubeconfig.yaml
# - kubectl config get-contexts
# - kubectl set image deployment/mon-deploiement mon-container=$IMAGE_TAG --namespace=mon-namespace
# only:
# - main
# needs: [push_image]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment