-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
79 lines (74 loc) · 2.16 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
stages:
- build
- docker-build
- release
backend-build:
image: clux/muslrust:1.85.0-nightly
stage: build
script:
- cd backend
- rustup target add "x86_64-unknown-linux-musl"
- cargo build --release --locked --target "x86_64-unknown-linux-musl"
cache:
- key:
files:
- backend/Cargo.lock
paths:
- backend/target
artifacts:
paths:
- backend/target/x86_64-unknown-linux-musl/release/backend
frontend-build:
image: node:23
stage: build
before_script:
- cd frontend
- corepack enable pnpm
- pnpm config set @lrd:registry=$CI_API_V4_URL/projects/$E3_SDK_PROJECT_ID/packages/npm/
- pnpm config set //gitlab.nist.gov/gitlab/api/v4/projects/$E3_SDK_PROJECT_ID/packages/npm/:_authToken="$E3_SDK_PROJECT_TOKEN"
- pnpm config list
script:
- pnpm install
- pnpm run build
cache:
- key:
files:
- frontend/pnpm-lock.yaml
paths:
- frontend/node_modules
artifacts:
paths:
- frontend/dist/*
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
docker-build:
image: docker:27.2.1
stage: docker-build
needs:
- backend-build
- frontend-build
tags:
- dind
services:
- docker:27.2.1-dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker build -t $IMAGE_TAG -f gitlab-dockerfile .
- docker push $IMAGE_TAG
portainer-deploy:
image: docker:27.2.1
stage: release
tags:
- dind
services:
- docker:27.2.1-dind
before_script:
- apk add jq curl
- unset DOCKER_HOST
- export AUTH_BODY=$(jq -c -n --arg username "$PORTAINER_USERNAME" --arg password "$PORTAINER_PASSWORD" '{username:$username,password:$password}')
- "export DOCKER_CUSTOM_HEADERS=\"Authorization=Bearer $(curl -s --header \"Content-Type: application\\json\" --request POST --data \"$AUTH_BODY\" http://haproxy-p.el.nist.gov:9000/api/auth | jq -r .jwt)\""
- docker context create portainer --docker "host=tcp://haproxy-p.el.nist.gov:9000/api/endpoints/1/docker"
- docker context use portainer
script:
- docker stack deploy -c portainer-stack.yml --resolve-image always blcc