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

Update .gitlab-ci.yml

parent 091d89d4
...@@ -7,23 +7,25 @@ stages: ...@@ -7,23 +7,25 @@ stages:
build: build:
stage: build stage: build
script: script:
- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" . - docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" "$DOCKER_REGISTRY"
- docker image tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" "$CI_REGISTRY_IMAGE:latest" - docker build --pull -t "$DOCKER_REGISTRY/$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker push "$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 "$CI_REGISTRY_IMAGE:latest" - docker push "$DOCKER_REGISTRY/$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
- docker push "$DOCKER_REGISTRY/$CI_REGISTRY_IMAGE:latest"
except: except:
- master - master
deploy_production: deploy_production:
stage: deploy stage: deploy
script: script:
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" "$DOCKER_REGISTRY"
- export http_proxy=http://proxy.esrf.fr:3128 - export http_proxy=http://proxy.esrf.fr:3128
- 'which ssh-agent || ( apk update && apk add openssh-client )' - 'which ssh-agent || ( apk update && apk add openssh-client )'
- eval $(ssh-agent -s) - eval $(ssh-agent -s)
- echo "$SSH_DEPLOY_KEY_PROD" | ssh-add - - echo "$SSH_DEPLOY_KEY_PROD" | ssh-add -
- mkdir -p ~/.ssh - mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config - 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: environment:
name: production name: production
url: http://doi.esrf.fr/ url: http://doi.esrf.fr/
......
Supports Markdown
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