Skip to content

Commit 2146d0d

Browse files
committed
Build image for our purpose
Signed-off-by: Kai Fink <kai.fink@yahoo.de>
1 parent 1c8957b commit 2146d0d

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

.gitlab-ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
stages:
2+
- build-docker
3+
4+
build-image:
5+
stage: build-docker
6+
variables:
7+
# Additional options for Kaniko executor.
8+
# For more details see https://github.com/GoogleContainerTools/kaniko/blob/master/README.md#additional-flags
9+
KANIKO_ARGS: ""
10+
KANIKO_BUILD_CONTEXT: $CI_PROJECT_DIR
11+
VERSION: "1.0.0"
12+
CI_REGISTRY: "registry.sva-cloud.com"
13+
CI_REGISTRY_IMAGE: "argocd/argocd-vault-plugin"
14+
image:
15+
# For latest releases see https://github.com/GoogleContainerTools/kaniko/releases
16+
# Only debug/*-debug versions of the Kaniko image are known to work within Gitlab CI
17+
name: gcr.io/kaniko-project/executor:debug
18+
entrypoint: [""]
19+
script:
20+
- '[ $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH ] && export VERSION=latest'
21+
- mkdir -p /kaniko/.docker
22+
# Write credentials to access Gitlab Container Registry within the runner/ci
23+
- echo "$DOCKER_AUTH_CONFIG" > /kaniko/.docker/config.json
24+
# Build and push the container. To disable push add --no-push
25+
- /kaniko/executor --context $KANIKO_BUILD_CONTEXT --dockerfile Dockerfile.sva --destination $CI_REGISTRY/$CI_REGISTRY_IMAGE:$VERSION $KANIKO_ARGS

Dockerfile.sva

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM index.docker.io/golang:1.21 AS builder
2+
3+
WORKDIR '/build'
4+
5+
COPY . .
6+
7+
8+
RUN go mod download
9+
RUN make build
10+
11+
FROM alpine
12+
13+
RUN wget -O /usr/local/bin/gomplate https://github.com/hairyhenderson/gomplate/releases/download/v4.1.0/gomplate_linux-amd64
14+
RUN chmod +x /usr/local/bin/gomplate
15+
COPY --from=builder /build/argocd-vault-plugin /usr/local/bin/argocd-vault-plugin
16+
17+
18+
ENTRYPOINT ["/bin/sh"]

0 commit comments

Comments
 (0)