-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
45 lines (38 loc) · 834 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
39
40
41
42
43
44
45
image: node:21-alpine
services:
- docker:dind
stages:
- install
- unit_test
- build
variables:
TAG_LATEST: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:latest
TAG_COMMIT: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA
cache:
paths:
- node_modules/
install_job:
stage: install
script:
- npm install
- npm run lint
unit_test_job:
stage: unit_test
script:
- npm run test
build_job:
image: docker:latest
stage: build
needs:
- unit_test_job
dependencies:
- unit_test_job
script:
- docker build -t $TAG_COMMIT -t $TAG_LATEST -f Dockerfile.pro .
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker push $TAG_COMMIT
- docker push $TAG_LATEST
rules:
- if: $CI_COMMIT_SHORT_SHA
exists:
- Dockerfile.pro