-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
79 lines (69 loc) · 2.63 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
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
72
73
74
75
76
77
78
79
image: alpine:latest
variables:
DOCKER_DRIVER: overlay2
stages:
- build
build:
stage: build
image: docker:stable-git
services:
- docker:stable-dind
script:
- setup_docker
- build
.auto_devops: &auto_devops |
set -x
export CI_APPLICATION_REPOSITORY=$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG
export CI_APPLICATION_TAG=$CI_COMMIT_SHA
function setup_docker() {
if ! docker info &>/dev/null; then
if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
export DOCKER_HOST='tcp://localhost:2375'
fi
fi
}
function registry_login() {
if [[ -n "$CI_REGISTRY_USER" ]]; then
echo "Logging to GitLab Container Registry with CI credentials..."
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
echo ""
fi
}
function build() {
registry_login
cd latex
docker build \
--build-arg HTTP_PROXY="$HTTP_PROXY" \
--build-arg http_proxy="$http_proxy" \
--build-arg HTTPS_PROXY="$HTTPS_PROXY" \
--build-arg https_proxy="$https_proxy" \
--build-arg FTP_PROXY="$FTP_PROXY" \
--build-arg ftp_proxy="$ftp_proxy" \
--build-arg NO_PROXY="$NO_PROXY" \
--build-arg no_proxy="$no_proxy" \
-t "registry.gitlab.com/kimvanwyk/document-containers/latex:$CI_APPLICATION_TAG" .
echo "Pushing to GitLab Container Registry..."
docker push "registry.gitlab.com/kimvanwyk/document-containers/latex:$CI_APPLICATION_TAG"
docker tag "registry.gitlab.com/kimvanwyk/document-containers/latex:$CI_APPLICATION_TAG" "registry.gitlab.com/kimvanwyk/document-containers/latex:latest"
docker push "registry.gitlab.com/kimvanwyk/document-containers/latex:latest"
echo ""
cd ../pandoc
docker build \
--build-arg HTTP_PROXY="$HTTP_PROXY" \
--build-arg http_proxy="$http_proxy" \
--build-arg HTTPS_PROXY="$HTTPS_PROXY" \
--build-arg https_proxy="$https_proxy" \
--build-arg FTP_PROXY="$FTP_PROXY" \
--build-arg ftp_proxy="$ftp_proxy" \
--build-arg NO_PROXY="$NO_PROXY" \
--build-arg no_proxy="$no_proxy" \
-t "registry.gitlab.com/kimvanwyk/document-containers/pandoc:$CI_APPLICATION_TAG" .
echo "Pushing to GitLab Container Registry..."
docker push "registry.gitlab.com/kimvanwyk/document-containers/pandoc:$CI_APPLICATION_TAG"
docker tag "registry.gitlab.com/kimvanwyk/document-containers/pandoc:$CI_APPLICATION_TAG" "registry.gitlab.com/kimvanwyk/document-containers/pandoc:latest"
docker push "registry.gitlab.com/kimvanwyk/document-containers/pandoc:latest"
echo ""
cd ../
}
before_script:
- *auto_devops