Newer
Older
variables:
GIT_STRATEGY: fetch
GIT_SSL_NO_VERIFY: "true"
GIT_SUBMODULE_STRATEGY: recursive
GIT_LFS_SKIP_SMUDGE: 1
IMAGE_COMMIT: 15b9c35 # Need to be updated when image_build is run. Should be the first 7 digits of the commit ID from the image_build
stages:
- build
image_build:
stage: build
image: docker:stable
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN http://$CI_REGISTRY
- CI_COMMIT_SHA_7=$(echo $CI_COMMIT_SHA | cut -c1-7)
- docker build --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA_7 .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA_7
tags:
- image-build
only:
changes:
- Dockerfile
- requirements.txt
scripts:
stage: build
image: $CI_REGISTRY_IMAGE:$IMAGE_COMMIT
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- ssh -o -t StrictHostKeyChecking=no dataops@148.187.97.230