proxy-detection/.gitlab-ci.yml
2025-06-06 08:49:45 -04:00

50 lines
No EOL
1.3 KiB
YAML

# Simple GitLab CI/CD Pipeline - Build and Deploy only
stages:
- build
- deploy
variables:
DOCKER_DRIVER: overlay2
IMAGE_NAME: $CI_REGISTRY_IMAGE
IMAGE_TAG: $CI_COMMIT_SHA
# Build and push Docker image
build:
stage: build
image: docker:24.0.5
services:
- docker:24.0.5-dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
variables:
DOCKER_TLS_CERTDIR: "/certs"
script:
- docker info
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE:latest || true
- docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE:latest .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker push $CI_REGISTRY_IMAGE:latest
only:
- master
# Deploy to production
deploy:
stage: deploy
image:
name: bitnami/kubectl:latest
entrypoint: ['']
variables:
KUBE_CONTEXT: stare/infra:ovh-cluster
script:
- kubectl get pods
- kubectl rollout restart deployment/proxy-detection-api
- kubectl rollout status deployment/proxy-detection-api --timeout=300s
- kubectl get pods -l app=proxy-detection-api
environment:
name: production
only:
- master