-
Notifications
You must be signed in to change notification settings - Fork 18
/
.gitlab-ci.yml
66 lines (59 loc) · 2.19 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
image: docker/compose:latest
services:
- docker:dind
stages:
- build
- run
- deploy
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- apk add bash
build:
stage: build
script:
- export DOCKER_PATH=docker/dockerfile-builder
- export REPO_NAME=$CI_REGISTRY_IMAGE/tmt-builder
- export IMAGE_NAME=$REPO_NAME:$CI_COMMIT_REF_NAME
# Copy GitLab environment variables files with credentials
- cp ${TRANSIFEX_CFG} cfg/credentials/transifexrc
- cp ${ZANATA_CFG} cfg/credentials/zanata.yaml
- cp ${WEBLATE_CFG} cfg/credentials/weblate.yaml
- cp ${CROWDIN_CFG} cfg/credentials/crowdin.yaml
- docker build --no-cache --tag tmt-builder --tag $IMAGE_NAME . -f $DOCKER_PATH
- docker push $IMAGE_NAME
build-languagetool:
stage: build
script:
- export DOCKER_PATH=docker/dockerfile-languagetool
- export REPO_NAME=$CI_REGISTRY_IMAGE/tmt-languagetool
- export IMAGE_NAME=$REPO_NAME:$CI_COMMIT_REF_NAME
- docker build --tag tmt-languagetool --tag $IMAGE_NAME docker/ -f $DOCKER_PATH
- docker push $IMAGE_NAME
variables:
TRIGGER_DEPLOY: 'true'
run:
stage: run
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_PIPELINE_SOURCE == "web"
when: always
script:
- bash docker/stop-docker.sh
- set
- export REPO_NAME=$CI_REGISTRY_IMAGE/tmt-data
- export IMAGE_NAME=$REPO_NAME:$CI_COMMIT_REF_NAME
- docker-compose -f docker/docker-compose-run-job.yml pull
- docker-compose -f docker/docker-compose-run-job.yml run -d --use-aliases --name translation-memory-tools-lt tmt-languagetool
- docker-compose -f docker/docker-compose-run-job.yml run -v /srv/volumes/tmt-files:/srv/tmt-files --use-aliases --name translation-memory-tools tmt-builder
- docker cp translation-memory-tools:/srv/web-docker web-docker
- docker container rm translation-memory-tools
- docker build -t $IMAGE_NAME . -f docker/dockerfile-data
- docker push $IMAGE_NAME
- bash docker/stop-docker.sh
deploy:
stage: deploy
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_PIPELINE_SOURCE == "web"
when: always
trigger: github/translation-memory-tools-webservice