-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
67 lines (58 loc) · 1.86 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
# Official docker image.
stages :
- build
- test
- deploy
image: docker:latest
services:
- docker:dind
variables:
IMAGE_TAG_TEST_GROUP: registry.gitlab.com/gis_manti/gis_front
IMAGE_TAG_TEST_LOCAL : registry.gitlab.com/yossefaz/gis_front
IMAGE_TAG_PROD: yossefaz/gis_front:latest
########GROUP#########
build_docker_image_group:
stage: build
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $IMAGE_TAG_TEST_GROUP -f Dockerfile.dev .
- docker push $IMAGE_TAG_TEST_GROUP
only :
- master
test_react_app_group:
stage: test
script:
- docker kill $(docker ps -q) || true
- docker rm $(docker ps -a -q) || true
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker run -dt -e CI=true $IMAGE_TAG_TEST_GROUP # TODO : add "npm test -- --coverage" after building tests
- docker kill $(docker ps -q) || true
only :
- master
########LOCAL#########
build_docker_image_local :
stage: build
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $IMAGE_TAG_TEST_LOCAL -f Dockerfile.dev .
- docker push $IMAGE_TAG_TEST_LOCAL
only :
- develop
test_react_app_local:
stage: test
script:
- docker kill $(docker ps -q) || true
- docker rm $(docker ps -a -q) || true
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker run -dt -e CI=true $IMAGE_TAG_TEST_LOCAL # TODO : add "npm test -- --coverage" after building tests
- docker kill $(docker ps -q) || true
only :
- develop
deploy_to_registry:
stage: deploy
script:
- docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASSWORD
- docker build -t $IMAGE_TAG_PROD .
- docker push $IMAGE_TAG_PROD
only:
- develop