Remove unneeded docker build scripts, add docker tag and service

This commit is contained in:
Annie Elequin 2021-09-16 13:20:52 -04:00
parent 6efbc3860e
commit 47962cafbc

View File

@ -1,7 +1,7 @@
stages:
- build
- build docker
- manifest
# - manifest
.build: &build
stage: build
@ -16,10 +16,10 @@ stages:
- git clone https://github.com/karmanyaahm/groupme.git ./groupme
- git clone https://github.com/karmanyaahm/mautrix-go.git ./mautrix
script:
- go build -ldflags "$GO_LDFLAGS" -o mautrix-whatsapp
- go build -ldflags "$GO_LDFLAGS" -o mautrix-groupme
artifacts:
paths:
- mautrix-whatsapp
- mautrix-groupme
- example-config.yaml
.build-docker: &build-docker
@ -37,18 +37,20 @@ build amd64:
<<: *build
image: dock.mau.dev/tulir/gomuks-build-docker:linux-amd64
build arm64:
<<: *build
image: dock.mau.dev/tulir/gomuks-build-docker:linux-arm64
# build arm64:
# <<: *build
# image: dock.mau.dev/tulir/gomuks-build-docker:linux-arm64
build arm:
<<: *build
image: dock.mau.dev/tulir/gomuks-build-docker:linux-arm
# build arm:
# <<: *build
# image: dock.mau.dev/tulir/gomuks-build-docker:linux-arm
build docker amd64:
<<: *build-docker
tags:
- amd64
- docker
services:
- docker:dind
dependencies:
- build amd64
needs:
@ -63,30 +65,30 @@ build docker amd64:
curl "$NOVA_ADMIN_API_URL" -H "Content-Type: application/json" -d '{"password":"'"$NOVA_ADMIN_NIGHTLY_PASS"'","bridge":"'$NOVA_BRIDGE_TYPE'","image":"'$CI_REGISTRY_IMAGE':'$CI_COMMIT_SHA'-amd64"}'
fi
build docker arm64:
<<: *build-docker
tags:
- arm64
dependencies:
- build arm64
needs:
- build arm64
variables:
DOCKER_ARCH: arm64
# build docker arm64:
# <<: *build-docker
# tags:
# - arm64
# dependencies:
# - build arm64
# needs:
# - build arm64
# variables:
# DOCKER_ARCH: arm64
manifest:
stage: manifest
variables:
GIT_STRATEGY: none
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
needs:
- build docker amd64
- build docker arm64
script:
- 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
# manifest:
# stage: manifest
# variables:
# GIT_STRATEGY: none
# 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
# needs:
# - build docker amd64
# - build docker arm64
# script:
# - 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