-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
61 lines (49 loc) · 1.98 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
61 lines (49 loc) · 1.98 KB
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
include:
- template: Jobs/Container-Scanning.gitlab-ci.yml
image: docker:latest
services:
- docker:dind
stages:
- build
- tag
- push
- test
variables:
DOCKER_DRIVER: overlay2
GIT_SUBMODULE_STRATEGY: recursive
GITLAB_REGISTRY_API_IMAGE: $CI_REGISTRY_IMAGE/api
GITLAB_REGISTRY_UI_IMAGE: $CI_REGISTRY_IMAGE/ui
GITLAB_REGISTRY_CAR_IMAGE: $CI_REGISTRY_IMAGE/car
SHA: $CI_COMMIT_SHA
before_script: # Log in to GitLab Container Registry
- echo $CI_JOB_TOKEN | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
build_api:
stage: build
script:
- docker-compose build api # Ensure the image is built
- echo "Tagging as $GITLAB_REGISTRY_API_IMAGE tag"
- docker tag ghcr.io/forallsecure-customersolutions/mayhem-demo/api:${SHA:-latest} $GITLAB_REGISTRY_API_IMAGE:$SHA
- docker tag ghcr.io/forallsecure-customersolutions/mayhem-demo/api:${SHA:-latest} $GITLAB_REGISTRY_API_IMAGE:latest
- docker push $GITLAB_REGISTRY_API_IMAGE:$SHA
- docker push $GITLAB_REGISTRY_API_IMAGE:latest
build_ui:
stage: build
script:
- docker-compose build ui # Ensure the image is built
- docker tag ghcr.io/forallsecure-customersolutions/mayhem-demo/ui:${SHA:-latest} $GITLAB_REGISTRY_UI_IMAGE:$SHA
- docker tag ghcr.io/forallsecure-customersolutions/mayhem-demo/ui:${SHA:-latest} $GITLAB_REGISTRY_UI_IMAGE:latest
- docker push $GITLAB_REGISTRY_UI_IMAGE:$SHA
- docker push $GITLAB_REGISTRY_UI_IMAGE:latest
build_car:
stage: build
script:
- docker-compose build car # Ensure the image is built
- docker tag ghcr.io/forallsecure-customersolutions/mayhem-demo/car:${SHA:-latest} $GITLAB_REGISTRY_CAR_IMAGE:$SHA
- docker tag ghcr.io/forallsecure-customersolutions/mayhem-demo/car:${SHA:-latest} $GITLAB_REGISTRY_CAR_IMAGE:latest
- docker push $GITLAB_REGISTRY_CAR_IMAGE:$SHA
- docker push $GITLAB_REGISTRY_CAR_IMAGE:latest
container_scanning:
inherit:
default: false
variables:
CS_IMAGE: $GITLAB_REGISTRY_API_IMAGE:latest