-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
40 lines (35 loc) · 826 Bytes
/
.gitlab-ci.yml
File metadata and controls
40 lines (35 loc) · 826 Bytes
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
stages:
- build
- docker
- deploy
variables:
DOCKER_DRIVER: overlay2
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
before_script:
- echo "Starting pipeline for $CI_PROJECT_NAME"
build:
stage: build
image: golang:1.21
script:
- go mod tidy
- go test ./...
- go build -o app ./cmd
artifacts:
paths:
- app
docker-build:
stage: docker
image: docker:latest
services:
- docker:dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
deploy:
stage: deploy
image: bitnami/kubectl:latest
script:
- kubectl config use-context minikube
- kubectl set image deployment/user-service truebank-user-service=$IMAGE_TAG
- kubectl rollout status deployment/user-service