Skip to content
Snippets Groups Projects
Commit 303b93e4 authored by MENACER Mohamed's avatar MENACER Mohamed
Browse files

30 edition

parent 33061ae4
No related branches found
No related tags found
No related merge requests found
Pipeline #47320 failed
stages:
- build
- test
- push
- deploy
variables:
IMAGE_BACKEND: "$CI_REGISTRY_IMAGE/backend"
IMAGE_NGINX: "$CI_REGISTRY_IMAGE/nginx"
IMAGE_DB: "$CI_REGISTRY_IMAGE/db"
DOCKER_DRIVER: overlay2
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
build:
stage: build
script:
- docker build -t $IMAGE_BACKEND:latest ./backend
- docker build -t $IMAGE_NGINX:latest ./nginx
only:
- main
test:
stage: test
script:
- echo "Tests en cours..."
- docker run --rm $IMAGE_BACKEND:latest php -v
only:
- main
push:
stage: push
script:
- docker push $IMAGE_BACKEND:latest
- docker push $IMAGE_NGINX:latest
- docker-compose build
only:
- main
deploy:
stage: deploy
script:
- docker-compose up -d --build
only:
- main
environment:
name: production
url: http://your-server-ip
before_script:
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan your-server-ip >> ~/.ssh/known_hosts
script:
- ssh user@your-server-ip "cd /path/to/project && git pull && docker-compose pull && docker-compose up -d --build"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment