-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
71 lines (65 loc) · 2.57 KB
/
.gitlab-ci.yml
File metadata and controls
71 lines (65 loc) · 2.57 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
stages:
- build
#################### BUILD STAGE ####################
build_ui_image:
stage: build
before_script:
# Configure registries.
- |
rm ~/.docker/config.json
export REGISTRIES=""
# Login to gitlab docker registry.
if [ -n "$CI_REGISTRY_IMAGE" ]; then
echo "Logging in to gitlab registry."
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" \
$CI_REGISTRY
export REGISTRIES="$REGISTRIES $CI_REGISTRY_IMAGE"
echo "Logged in to gitlab registry."
else
echo "No credentials provided for gitlab registry, skipping."
fi
# Login to other registry.
if [ -n "$EXT_REGISTRY" ] && \
[ -n "$EXT_REGISTRY_IMAGE" ] && \
[ -n "$EXT_REGISTRY_USER" ] && \
[ -n "$EXT_REGISTRY_PASSWORD" ]
then
echo "Logging in to $EXT_REGISTRY."
docker login -u "$EXT_REGISTRY_USER" -p "$EXT_REGISTRY_PASSWORD" \
"$EXT_REGISTRY"
export REGISTRIES="$REGISTRIES $EXT_REGISTRY_IMAGE"
echo "Logged in to $EXT_REGISTRY."
else
echo "No credentials provided for external registry, skipping."
fi
# Login to dockerhub.
if [ -n "$DOCKERHUB_IMAGE" ] && \
[ -n "$DOCKERHUB_USER" ] && \
[ -n "$DOCKERHUB_PASSWORD" ]
then
echo "Logging in to dockerhub."
docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_PASSWORD"
export REGISTRIES="$REGISTRIES $DOCKERHUB_IMAGE"
echo "Logged in to dockerhub."
else
echo "No credentials provided for dockerhub, skipping."
fi
# Check if any registry configured.
if [ -z "$REGISTRIES" ]; then
echo "No registries configured, exiting."
exit 1
fi
variables:
GIT_SUBMODULE_STRATEGY: recursive
script:
- docker build --rm --build-arg build_tag=$CI_COMMIT_SHA -t registry.ops.mist.io/mistio/mist.ui:$CI_COMMIT_SHA .
- docker tag registry.ops.mist.io/mistio/mist.ui:$CI_COMMIT_SHA registry.ops.mist.io/mistio/mist.ui:$CI_COMMIT_REF_SLUG
- docker tag registry.ops.mist.io/mistio/mist.ui:$CI_COMMIT_SHA mist/ui:$CI_COMMIT_SHA
- docker tag registry.ops.mist.io/mistio/mist.ui:$CI_COMMIT_REF_SLUG mist/ui:$CI_COMMIT_REF_SLUG
- docker push registry.ops.mist.io/mistio/mist.ui:$CI_COMMIT_SHA
- docker push registry.ops.mist.io/mistio/mist.ui:$CI_COMMIT_REF_SLUG
- docker push mist/ui:$CI_COMMIT_SHA
- docker push mist/ui:$CI_COMMIT_REF_SLUG
tags:
- builder
dependencies: []