Commit 34de74a2 authored by Antoine Roux's avatar Antoine Roux 🦊

Update .gitlab-ci.yml

parent 091d89d4
Pipeline #5964 passed with stages
in 40 seconds
......@@ -7,23 +7,25 @@ stages:
build:
stage: build
script:
- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker image tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" "$CI_REGISTRY_IMAGE:latest"
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
- docker push "$CI_REGISTRY_IMAGE:latest"
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" "$DOCKER_REGISTRY"
- docker build --pull -t "$DOCKER_REGISTRY/$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker image tag "$DOCKER_REGISTRY/$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" "$DOCKER_REGISTRY/$CI_REGISTRY_IMAGE:latest"
- docker push "$DOCKER_REGISTRY/$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
- docker push "$DOCKER_REGISTRY/$CI_REGISTRY_IMAGE:latest"
except:
- master
deploy_production:
stage: deploy
script:
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" "$DOCKER_REGISTRY"
- export http_proxy=http://proxy.esrf.fr:3128
- 'which ssh-agent || ( apk update && apk add openssh-client )'
- eval $(ssh-agent -s)
- echo "$SSH_DEPLOY_KEY_PROD" | ssh-add -
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- ssh -l gitlab-deploy "$DEPLOY_HOST" "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
- ssh -l gitlab-deploy "$DEPLOY_HOST" "$DOCKER_REGISTRY/$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
environment:
name: production
url: http://doi.esrf.fr/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment