forked from DomiStyle/docker-tor-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
27 lines (25 loc) · 779 Bytes
/
.gitlab-ci.yml
File metadata and controls
27 lines (25 loc) · 779 Bytes
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
# Build a Docker image for branches and tags
docker-build:
image: docker:latest
stage: build
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
# Tagging images in following priority:
# * Commit tag name
# * latest if on master
# * Commit reference if on different branch
script:
- |
if [ -n "$CI_COMMIT_TAG" ]; then
tag="$CI_COMMIT_TAG"
elif [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
tag="latest"
else
tag="$CI_COMMIT_REF_SLUG"
fi
echo "Running on branch '$CI_COMMIT_BRANCH'"
echo "Tagging as '$tag'"
- docker build --pull -t "$CI_REGISTRY_IMAGE:${tag}" .
- docker push "$CI_REGISTRY_IMAGE:${tag}"