-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
32 lines (25 loc) · 924 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
image: docker
services:
- docker:dind
variables:
DOCKER_PREFIX: $CI_REGISTRY_IMAGE/
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
build:webcui:
extends: .build_docker_image
variables:
IMAGE: webcui
build:deployenv:
extends: .build_docker_image
variables:
IMAGE: deployenv
.build_docker_image:
stage: build
script:
- docker pull $CI_REGISTRY_IMAGE/$IMAGE:latest || true
- docker build --cache-from $CI_REGISTRY_IMAGE/$IMAGE:latest --tag $CI_REGISTRY_IMAGE/$IMAGE:$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE/$IMAGE:latest -f docker/$IMAGE.docker .
- docker push $CI_REGISTRY_IMAGE/$IMAGE:$CI_COMMIT_SHA
- docker push $CI_REGISTRY_IMAGE/$IMAGE:latest
test:
stage: test
script: docker run -e DOCKER_PORT=$DOCKER_PORT -e DOCKER_HOST=$DOCKER_PORT -e DOCKER_PREFIX=$DOCKER_PREFIX $CI_REGISTRY_IMAGE/webcui:$CI_COMMIT_SHA make test