forked from overleaf/overleaf
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
71 lines (68 loc) · 2.2 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
---
stages:
- docker
.docker_template:
stage: docker
tags:
- docker
variables:
DOCKER_TLS_CERTDIR: "/certs"
services:
- name: docker:dind
alias: docker
image: docker
before_script:
- apk add git
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
docker_other:
extends: .docker_template
script:
- >-
docker build
--cache-from ${CI_REGISTRY_IMAGE}/base:main
--cache-from ${CI_REGISTRY_IMAGE}/base:${CI_COMMIT_REF_SLUG}
--build-arg BUILDKIT_INLINE_CACHE=1
-t "${CI_REGISTRY_IMAGE}/base:${CI_COMMIT_REF_SLUG}"
-f ${CI_PROJECT_DIR}/server-ce/Dockerfile-base
${CI_PROJECT_DIR}
- docker push ${CI_REGISTRY_IMAGE}/base:${CI_COMMIT_REF_SLUG}
- >-
docker build
--cache-from ${CI_REGISTRY_IMAGE}:main
--cache-from ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}
--build-arg BUILDKIT_INLINE_CACHE=1
--build-arg OVERLEAF_BASE_TAG=${CI_REGISTRY_IMAGE}/base:${CI_COMMIT_REF_SLUG}
--build-arg MONOREPO_REVISION=${CI_COMMIT_SHA}
-t "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}"
-f ${CI_PROJECT_DIR}/server-ce/Dockerfile
${CI_PROJECT_DIR}
- docker push ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}
rules:
- if: $CI_COMMIT_BRANCH != "main"
docker_main:
extends: .docker_template
script:
- >-
docker build
--cache-from ${CI_REGISTRY_IMAGE}/base:main
--build-arg BUILDKIT_INLINE_CACHE=1
-t "${CI_REGISTRY_IMAGE}/base:main"
-t "${CI_REGISTRY_IMAGE}/base:latest"
-f ${CI_PROJECT_DIR}/server-ce/Dockerfile-base
${CI_PROJECT_DIR}
- docker push ${CI_REGISTRY_IMAGE}/base:main
- docker push ${CI_REGISTRY_IMAGE}/base:latest
- >-
docker build
--cache-from ${CI_REGISTRY_IMAGE}:main
--build-arg BUILDKIT_INLINE_CACHE=1
--build-arg OVERLEAF_BASE_TAG=${CI_REGISTRY_IMAGE}/base:main
--build-arg MONOREPO_REVISION=${CI_COMMIT_SHA}
-t "${CI_REGISTRY_IMAGE}:main"
-t "${CI_REGISTRY_IMAGE}:latest"
-f ${CI_PROJECT_DIR}/server-ce/Dockerfile
${CI_PROJECT_DIR}
- docker push ${CI_REGISTRY_IMAGE}:main
- docker push ${CI_REGISTRY_IMAGE}:latest
rules:
- if: $CI_COMMIT_BRANCH == "main"