-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
87 lines (78 loc) · 2.05 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
80
81
82
83
84
85
86
87
image: python:3.9-buster
stages:
- build
variables:
POSTGRES_DB: db
POSTGRES_USER: user
POSTGRES_PASSWORD: password
SQL_HOST: postgres
SQL_ENGINE: django.db.backends.postgresql
DOCKER_TLS_CERTDIR: "/certs"
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.pip-cache"
PYTHONUSERBASE: "$CI_PROJECT_DIR/.pip"
# This folder is cached between builds
# http://docs.gitlab.com/ee/ci/yaml/README.html#cache
cache:
paths:
- "$CI_PROJECT_DIR/.pip-cache"
- "$CI_PROJECT_DIR/.pip"
key: "$CI_PROJECT_DIR"
# This is a basic example for a gem or script which doesn't use
# services such as redis or postgres
docker-build-master:
# Official docker image.
image: docker
stage: build
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker pull $CI_REGISTRY_IMAGE:latest || true
- docker build --pull --cache-from "$CI_REGISTRY_IMAGE:latest" -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
only:
- master
docker-build:
# Official docker image.
image: docker
stage: build
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker pull $CI_REGISTRY_IMAGE:latest || true
- docker build --pull --cache-from "$CI_REGISTRY_IMAGE:latest" -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
except:
- master
build-ng:
image: node:16
stage: build
variables:
GIT_SUBMODULE_STRATEGY: normal
script:
- cd app/
- npm install
- npm run build app -- --prod
artifacts:
paths:
- app/dist/
expire_in: 20 minutes
cache:
key: node-cache
paths:
- app/node_modules/
docker-build-app:
image: docker
stage: build
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build -t "$CI_REGISTRY_IMAGE:ngx" app/
- docker push "$CI_REGISTRY_IMAGE:ngx"
needs:
- build-ng