forked from jacobalberty/unifi-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
41 lines (36 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
33
34
35
36
37
38
39
40
41
image: docker:latest
variables:
IMAGE_TAG: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}
CONTAINER_RELEASE_IMAGE: steynovich/unifi:${CI_COMMIT_TAG}
stages:
- build
- release
before_script:
- docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
build:
stage: build
services:
- name: docker:dind
alias: docker-dind
variables:
DOCKER_HOST: "tcp://docker-dind:2375"
script:
- echo "Building $IMAGE_TAG"
- docker build --rm -t $IMAGE_TAG .
- docker push $IMAGE_TAG
release:
stage: release
services:
- name: docker:dind
alias: docker-dind
variables:
DOCKER_HOST: "tcp://docker-dind:2375"
only:
- tags
script:
- echo "Releasing $CONTAINER_RELEASE_IMAGE"
- docker pull $IMAGE_TAG
- docker tag $IMAGE_TAG $CONTAINER_RELEASE_IMAGE
- docker push $CONTAINER_RELEASE_IMAGE