-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
80 lines (72 loc) · 2.42 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
stages:
- build
- deploy
image: moreillon/tdd-dind
services:
- name: docker:19.03.12-dind
variables:
APPLICATION_NAME: image-classifier-server
CONTAINER_IMAGE: ${AWS_ECR_PUBLIC_URL}/${APPLICATION_NAME}
CONTAINER_IMAGE_TAGGED_CPU: ${CONTAINER_IMAGE}:cpu-${CI_COMMIT_SHORT_SHA}
CONTAINER_IMAGE_TAGGED_GPU: ${CONTAINER_IMAGE}:gpu-${CI_COMMIT_SHORT_SHA}
CONTAINER_IMAGE_TAGGED_JETSON: ${CONTAINER_IMAGE}:jetson-${CI_COMMIT_SHORT_SHA}
K8S_NODEPORT: 30871
cpu:
stage: build
only:
- master
tags:
- dind
before_script:
- aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${AWS_ECR_PUBLIC_URL}
- >
aws ecr-public create-repository --region us-east-1 --repository-name ${APPLICATION_NAME}
|| echo "Repository might have already existed"
script:
- docker build -t ${CONTAINER_IMAGE_TAGGED_CPU} -f ./Dockerfile-cpu .
- docker push ${CONTAINER_IMAGE_TAGGED_CPU}
gpu:
stage: build
only:
- master
tags:
- dind
before_script:
# Registry login
- aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${AWS_ECR_PUBLIC_URL}
# Create repository in ECR if it does not exist yet
- >
aws ecr-public create-repository --region us-east-1 --repository-name ${APPLICATION_NAME}
|| echo "Repository might have already existed"
script:
- docker build -t ${CONTAINER_IMAGE_TAGGED_GPU} -f ./Dockerfile-gpu .
- docker push ${CONTAINER_IMAGE_TAGGED_GPU}
# jetson:
# stage: build
# only:
# - master
# tags:
# - dind
# before_script:
# # Registry login
# - aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${AWS_ECR_PUBLIC_URL}
# # Create repository in ECR if it does not exist yet
# - >
# aws ecr-public create-repository --region us-east-1 --repository-name ${APPLICATION_NAME}
# || echo "Repository might have already existed"
# script:
# - docker build -t ${CONTAINER_IMAGE_TAGGED_JETSON} -f ./Dockerfile-jetson .
# - docker push ${CONTAINER_IMAGE_TAGGED_JETSON}
deploy:
stage: deploy
only:
- master
- main
tags:
- internal
script:
- envsubst < kubernetes_manifest.yml | kubectl apply -f -
environment:
name: production
kubernetes:
namespace: ${K8S_NAMESPACE}