-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
59 lines (55 loc) · 2.62 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
image: node:14
stages:
- build
variables:
GIT_SUBMODULE_STRATEGY: recursive
REGISTRY: $CI_REGISTRY
SUDOSOS_BASE_TAG: sudosos/sudosos-devops/
SUDOSOS_BACK_END: back-end
SUDOSOS_FRONT_END: front-end
SUDOSOS_NGINX_PROXY: nginx-proxy
SUDOSOS_POINT_OF_SALE: point-of-sale
TYPEORM_USERNAME: $TYPEORM_USERNAME
TYPEORM_PASSWORD: $TYPEORM_PASSWORD
TYPEORM_DATABASE: $TYPEORM_DATABASE
dockerize:
image: docker:19.03
stage: build
services:
- docker:19.03-dind
before_script:
- apk update && apk add make
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
# ENV variables for the back-end can be set via docker-compose.
- cp "$ENV_FILE" ./sudosos-front-end/.env
- cp "$ENV_FILE" ./sudosos-point-of-sale/.env
script:
- docker build ./sudosos-"$SUDOSOS_BACK_END" -t "$REGISTRY"/"$SUDOSOS_BASE_TAG""$SUDOSOS_BACK_END" --build-arg TYPEORM_USERNAME=$TYPEORM_USERNAME --build-arg TYPEORM_PASSWORD=$TYPEORM_PASSWORD --build-arg TYPEORM_DATABASE=$TYPEORM_DATABASE
- docker build ./sudosos-"$SUDOSOS_FRONT_END" -t "$REGISTRY"/"$SUDOSOS_BASE_TAG""$SUDOSOS_FRONT_END"
- docker build ./sudosos-"$SUDOSOS_NGINX_PROXY" -t "$REGISTRY"/"$SUDOSOS_BASE_TAG""$SUDOSOS_NGINX_PROXY"
- docker build ./sudosos-"$SUDOSOS_POINT_OF_SALE" -t "$REGISTRY"/"$SUDOSOS_BASE_TAG""$SUDOSOS_POINT_OF_SALE"
- make push-all
environment:
name: Development
dockerize-production:
image: docker:19.03
stage: build
services:
- docker:19.03-dind
before_script:
- apk update && apk add make
- docker login --username="$PROD_REGISTRY_USER" --password="$PROD_REGISTRY_PASSWORD" $PROD_REGISTRY
# ENV variables for the back-end can be set via docker-compose.
- cp "$ENV_FILE" ./sudosos-front-end/.env
- cp "$ENV_FILE" ./sudosos-point-of-sale/.env
script:
- docker build ./sudosos-"$SUDOSOS_BACK_END" -t "$PROD_REGISTRY"/sudosos/"$SUDOSOS_BACK_END" --build-arg TYPEORM_USERNAME=$TYPEORM_USERNAME --build-arg TYPEORM_PASSWORD=$TYPEORM_PASSWORD --build-arg TYPEORM_DATABASE=$TYPEORM_DATABASE
- docker build ./sudosos-"$SUDOSOS_FRONT_END" -t "$PROD_REGISTRY"/sudosos/"$SUDOSOS_FRONT_END"
- docker build ./sudosos-"$SUDOSOS_NGINX_PROXY" -t "$PROD_REGISTRY"/sudosos/"$SUDOSOS_NGINX_PROXY"
- docker build ./sudosos-"$SUDOSOS_POINT_OF_SALE" -t "$PROD_REGISTRY"/sudosos/"$SUDOSOS_POINT_OF_SALE"
- docker push "$PROD_REGISTRY"/sudosos/"$SUDOSOS_BACK_END"
- docker push "$PROD_REGISTRY"/sudosos/"$SUDOSOS_FRONT_END"
- docker push "$PROD_REGISTRY"/sudosos/"$SUDOSOS_NGINX_PROXY"
- docker push "$PROD_REGISTRY"/sudosos/"$SUDOSOS_POINT_OF_SALE"
environment:
name: Production