-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
37 lines (29 loc) · 935 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
image: docker:latest
cache:
paths:
- node_modules/
variables:
DOCKER_DRIVER: overlay
CI_REGISTRY: registry.gitlab.com
CI_REGISTRY_TEST_IMAGE: registry.gitlab.com/teamtibet/tibet:$CI_BUILD_REF_NAME
CI_REGISTRY_TEST_CACHE_IMAGE: registry.gitlab.com/teamtibet/tibet:ci_cache
CI_REGISTRY_RELEASE_IMAGE: registry.gitlab.com/teamtibet/tibet:latest
services:
- docker:dind
stages:
- build
- test
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
build:
stage: build
script:
- docker pull $CI_REGISTRY_TEST_CACHE_IMAGE || true
- docker build --cache-from $CI_REGISTRY_TEST_CACHE_IMAGE -f Dockerfile_CI -t $CI_REGISTRY_TEST_IMAGE .
- docker push $CI_REGISTRY_TEST_IMAGE
- docker tag $CI_REGISTRY_TEST_IMAGE $CI_REGISTRY_TEST_CACHE_IMAGE
- docker push $CI_REGISTRY_TEST_CACHE_IMAGE
docker_test:
stage: test
script:
- docker run $CI_REGISTRY_TEST_IMAGE