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: stages:
- build - build
- build docker - build docker
- manifest # - manifest
.build: &build .build: &build
stage: build stage: build
@ -16,10 +16,10 @@ stages:
- git clone https://github.com/karmanyaahm/groupme.git ./groupme - git clone https://github.com/karmanyaahm/groupme.git ./groupme
- git clone https://github.com/karmanyaahm/mautrix-go.git ./mautrix - git clone https://github.com/karmanyaahm/mautrix-go.git ./mautrix
script: script:
- go build -ldflags "$GO_LDFLAGS" -o mautrix-whatsapp - go build -ldflags "$GO_LDFLAGS" -o mautrix-groupme
artifacts: artifacts:
paths: paths:
- mautrix-whatsapp - mautrix-groupme
- example-config.yaml - example-config.yaml
.build-docker: &build-docker .build-docker: &build-docker
@ -37,18 +37,20 @@ build amd64:
<<: *build <<: *build
image: dock.mau.dev/tulir/gomuks-build-docker:linux-amd64 image: dock.mau.dev/tulir/gomuks-build-docker:linux-amd64
build arm64: # build arm64:
<<: *build # <<: *build
image: dock.mau.dev/tulir/gomuks-build-docker:linux-arm64 # image: dock.mau.dev/tulir/gomuks-build-docker:linux-arm64
build arm: # build arm:
<<: *build # <<: *build
image: dock.mau.dev/tulir/gomuks-build-docker:linux-arm # image: dock.mau.dev/tulir/gomuks-build-docker:linux-arm
build docker amd64: build docker amd64:
<<: *build-docker <<: *build-docker
tags: tags:
- amd64 - docker
services:
- docker:dind
dependencies: dependencies:
- build amd64 - build amd64
needs: 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"}' 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 fi
build docker arm64: # build docker arm64:
<<: *build-docker # <<: *build-docker
tags: # tags:
- arm64 # - arm64
dependencies: # dependencies:
- build arm64 # - build arm64
needs: # needs:
- build arm64 # - build arm64
variables: # variables:
DOCKER_ARCH: arm64 # DOCKER_ARCH: arm64
manifest: # manifest:
stage: manifest # stage: manifest
variables: # variables:
GIT_STRATEGY: none # GIT_STRATEGY: none
before_script: # before_script:
- "mkdir -p $HOME/.docker && echo '{\"experimental\": \"enabled\"}' > $HOME/.docker/config.json" # - "mkdir -p $HOME/.docker && echo '{\"experimental\": \"enabled\"}' > $HOME/.docker/config.json"
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY # - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
needs: # needs:
- build docker amd64 # - build docker amd64
- build docker arm64 # - build docker arm64
script: # script:
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 # - docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64 # - 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: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 # - 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 # - docker rmi $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64