From 0541e8044c73c11529504866daf2024c8c1f1736 Mon Sep 17 00:00:00 2001 From: Thomas Schneider <thomas@fsmpi.rwth-aachen.de> Date: Thu, 23 Jun 2022 16:55:01 +0200 Subject: [PATCH] WIP: add container build stuff --- .gitlab-ci.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c10ee44..415bbff 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,3 +28,40 @@ lint: reports: junit: golangci-output.xml expire_in: 7 days + +build-binary: + image: golang:1-alpine + stage: build + before_script: + - go version + script: + - >- + CGO_ENABLED=0 + go build + -v + -o webhook + -ldflags '-w -s -extldflags "-static"' + . + artifacts: + paths: + - webhook + +build-image: + image: alpine:3 + stage: deploy + needs: + - build + before_script: + - apk --no-cache add buildah ca-certificates-bundle + - >- + buildah login + --username "$CI_REGISTRY_USER" + --password "$CI_REGISTRY_PASSWORD" + "$CI_REGISTRY" + script: + - ctr=$(buildah from scratch) + - buildah copy $ctr /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt + - buildah copy $ctr webhook /webhook + - buildah config --entrypoint '["/webhook"]' $ctr + - buildah commit --squash $ctr $CI_REGISTRY_IMAGE:exp-$CI_COMMIT_SHA + - buildah push $CI_REGISTRY_IMAGE:exp-$CI_COMMIT_SHA -- GitLab