-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
38 lines (31 loc) · 998 Bytes
/
.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
image: docker
variables:
CONTAINER_SETUP_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-setup
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- apk add --no-cache jq
stages:
- setup
- quality
- production
build setup image:
stage: setup
script:
- docker build --pull -t $CONTAINER_SETUP_IMAGE_NAME --target setup-stage .
- docker push $CONTAINER_SETUP_IMAGE_NAME
verify code lint:
stage: quality
script:
- docker pull $CONTAINER_SETUP_IMAGE_NAME
- docker run --rm $CONTAINER_SETUP_IMAGE_NAME npm run lint
build production image:
stage: production
only:
- master
script:
- docker pull $CONTAINER_SETUP_IMAGE_NAME || true
- export VERSION=$(cat package.json | jq -r .version)
- docker build --pull -t $CI_REGISTRY_IMAGE:latest .
- docker tag $CI_REGISTRY_IMAGE:latest $CI_REGISTRY_IMAGE:$VERSION
- docker push $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:$VERSION