-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
47 lines (42 loc) · 1.03 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
default:
image: docker
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
variables:
DOCKER_HOST: tcp://dind-rootless:2375
stages:
- build
build-latest:
stage: build
script:
- IMAGE_NAME=$CI_REGISTRY_IMAGE:latest
- >-
echo "Start time: $(date)"
- >-
docker build
--build-arg SOURCE_COMMIT="$CI_COMMIT_SHA"
--build-arg COMMIT_MSG="$CI_COMMIT_MESSAGE"
--build-arg BUILD_TIME="$(date)"
--pull -t $IMAGE_NAME .
- docker push $IMAGE_NAME
- >-
echo "Finish time: $(date)"
only:
- master
build-tag:
stage: build
script:
- IMAGE_NAME=$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
- >-
echo "Start time: $(date)"
- >-
docker build
--build-arg SOURCE_COMMIT="$CI_COMMIT_SHA"
--build-arg COMMIT_MSG="$CI_COMMIT_MESSAGE"
--build-arg BUILD_TIME="$(date)"
--pull -t $IMAGE_NAME .
- docker push $IMAGE_NAME
- >-
echo "Finish time: $(date)"
only:
- tags