Skip to content
Snippets Groups Projects
Commit a24523bd authored by Thomas Schneider's avatar Thomas Schneider
Browse files

WIP: add container build stuff

parent 17288401
Branches
No related tags found
No related merge requests found
Pipeline #4149 passed
cert-manager-webhook-rwth
*.config
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
# Go workspace file
go.work
.git
.gitlab-ci.yml
.gitignore
.containerignore
\ No newline at end of file
...@@ -28,3 +28,18 @@ lint: ...@@ -28,3 +28,18 @@ lint:
reports: reports:
junit: golangci-output.xml junit: golangci-output.xml
expire_in: 7 days expire_in: 7 days
build-image:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
stage: deploy
before_script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor version
script:
- >-
/kaniko/executor
--context $CI_PROJECT_DIR
--dockerfile Containerfile
--destination $CI_REGISTRY_IMAGE:exp-$CI_COMMIT_SHA
FROM docker.io/library/golang:1-alpine AS build
ARG GOARCH="amd64"
ARG GOARM=""
WORKDIR /workspace
ENV GOPATH="/workspace/.go"
COPY . .
RUN go mod download
RUN CGO_ENABLED=0 GOARCH=$GOARCH GOARM=$GOARM go build -v -o webhook -ldflags '-w -s -extldflags "-static"' .
FROM scratch
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /workspace/webhook /webhook
ENTRYPOINT ["/webhook"]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment