maubot/.gitlab-ci.yml

53 lines
2.4 KiB
YAML
Raw Normal View History

2019-07-28 18:07:56 +00:00
image: docker:stable
stages:
- build
2020-02-25 20:32:32 +00:00
- manifest
2019-07-28 18:07:56 +00:00
default:
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
2020-02-25 20:32:32 +00:00
build amd64:
2019-07-28 18:07:56 +00:00
stage: build
2020-02-25 20:32:32 +00:00
tags:
- amd64
2019-07-28 18:07:56 +00:00
script:
- docker pull $CI_REGISTRY_IMAGE:latest || true
2020-02-25 20:32:32 +00:00
- docker build --pull --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64
- docker rmi $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64
2019-07-28 18:07:56 +00:00
2020-02-25 20:32:32 +00:00
build arm64:
stage: build
tags:
- arm64
2019-07-28 18:07:56 +00:00
script:
2020-02-25 20:32:32 +00:00
- docker pull $CI_REGISTRY_IMAGE:latest || true
- docker build --pull --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64 .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64
- docker rmi $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64
2019-07-28 18:07:56 +00:00
2020-02-25 20:32:32 +00:00
manifest:
stage: manifest
before_script:
- "mkdir -p $HOME/.docker && echo '{\"experimental\": \"enabled\"}' > $HOME/.docker/config.json"
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
2019-07-28 18:07:56 +00:00
script:
2020-02-25 20:32:32 +00:00
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64
- if [ $CI_COMMIT_BRANCH == "master" ]; then docker manifest create $CI_REGISTRY_IMAGE:latest $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64 && docker manifest push $CI_REGISTRY_IMAGE:latest; fi
- if [ $CI_COMMIT_BRANCH != "master" ]; then docker manifest create $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64 && docker manifest push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME; fi
- docker rmi $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64
2019-10-22 22:14:54 +00:00
2020-02-25 20:32:32 +00:00
build standalone amd64:
2019-10-22 22:14:54 +00:00
stage: build
2020-02-25 20:32:32 +00:00
tags:
- amd64
2019-10-22 22:14:54 +00:00
script:
- docker pull $CI_REGISTRY_IMAGE:standalone || true
2019-10-22 22:53:47 +00:00
- docker build --pull --cache-from $CI_REGISTRY_IMAGE:standalone --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-standalone . -f maubot/standalone/Dockerfile
2020-02-25 20:32:32 +00:00
- if [ $CI_COMMIT_BRANCH == "master" ]; then docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-standalone $CI_REGISTRY_IMAGE:standalone && docker push $CI_REGISTRY_IMAGE:standalone; fi
- if [ $CI_COMMIT_BRANCH != "master" ]; then docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-standalone $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-standalone && docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-standalone; fi