-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
36 lines (30 loc) · 1.38 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Using example from https://ucsd-prp.gitlab.io/userdocs/development/gitlab/
# Using kaniko maybe faster than normal docker build overtime with caching
image: gcr.io/kaniko-project/executor:debug
stages:
- build-and-push
build-and-push-job:
stage: build-and-push
variables:
GODEBUG: "http2client=0"
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --cache=true --push-retry=10 --context $CI_PROJECT_DIR/model_trainer/ --dockerfile $CI_PROJECT_DIR/model_trainer/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA --destination $CI_REGISTRY_IMAGE:latest
# image: docker:git
# default:
# tags:
# - docker
# before_script:
# - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# stages:
# - build-and-push
# build-and-push-job:
# stage: build-and-push
# script:
# - cd $CI_PROJECT_DIR && docker build ./model_trainer -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
# - docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA $CI_REGISTRY_IMAGE:latest
# - docker inspect -f "{{ .Size }}" $CI_REGISTRY_IMAGE:latest
# - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
# - docker push $CI_REGISTRY_IMAGE:latest
# - docker rmi -f $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA $CI_REGISTRY_IMAGE:latest
# - docker builder prune -a -f