-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy path.gitlab-ci.yml
61 lines (54 loc) · 1.33 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
image: docker:19.03.8
variables:
DOCKER_DRIVER: overlay2
BUILDER_TAG: index.docker.io/algorithmiahq/dev-center:latest
IMAGE_TAG: index.docker.io/algorithmiahq/dev-center:$CI_COMMIT_SHA
services:
- docker:18.09.7-dind
stages:
- build
- push
#
# Build
#
build:
stage: build
image:
name: docker:19.03.8
entrypoint: [""]
before_script:
- mkdir ~/.docker
- echo "$DOCKER_AUTH_CONFIG" > ~/.docker/config.json
# Prevent two images with the same tag from being deployed. The Webpack
# assets from each build will be different, resulting in 404s as different
# container versions handle requests meant for the other version.
- docker pull $IMAGE_TAG && echo "An image with this tag has already been pushed." && exit 1
- docker pull $BUILDER_TAG || true
script:
- docker build
-t $BUILDER_TAG
-t $IMAGE_TAG
--file $CI_PROJECT_DIR/Dockerfile
--no-cache
--pull
$CI_PROJECT_DIR
- docker push $BUILDER_TAG
- mkdir image
- docker save $IMAGE_TAG > image/golduck.tar
artifacts:
paths:
- image
#
# Push
#
push:
stage: push
image:
name: docker:19.03.8
entrypoint: [""]
before_script:
- mkdir ~/.docker
- echo "$DOCKER_AUTH_CONFIG" > ~/.docker/config.json
script:
- docker load -i image/golduck.tar
- docker push $IMAGE_TAG