workflow now builds and pushes app image

This commit is contained in:
franz.germann1 2024-10-28 14:32:16 +01:00
parent 8cd4ab3cb6
commit 4ef5f42900
3 changed files with 22 additions and 24 deletions

View file

@ -1,2 +1,16 @@
FROM ubuntu:latest
RUN apt update
FROM golang:latest AS builder
WORKDIR /shared-data/app
COPY ./ ./
# RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -o fibonacci_go .
FROM alpine:latest
WORKDIR /shared-data/app
COPY --from=builder /shared-data/app/fibonacci_go .
ENTRYPOINT [ "/shared-data/app/fibonacci_go" ]

View file

@ -1,16 +0,0 @@
FROM golang:latest AS builder
WORKDIR /shared-data/app
COPY ./ ./
# RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -o fibonacci_go .
FROM alpine:latest
WORKDIR /shared-data/app
COPY --from=builder /shared-data/app/fibonacci_go .
ENTRYPOINT [ "/shared-data/app/fibonacci_go" ]

View file

@ -111,15 +111,16 @@ spec:
image: gcr.io/kaniko-project/executor:v1.23.2
args:
[
"--dockerfile=/shared-data/repo/Dockerfile",
"--dockerfile=Dockerfile",
"--context=/shared-data/repo/",
"--destination=forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/franz.germann/fibonacci_go:latest",
"--destination=gitea.cnoe.localtest.me/giteaadmin/fibonacci_go:latest",
"--skip-tls-verify"
]
volumeMounts:
- name: shared-data
mountPath: /shared-data
- name: docker-config
mountPath: /kaniko/.docker
mountPath: /kaniko/.docker/
- name: unit-tests
container:
@ -128,8 +129,7 @@ spec:
args:
- |
cd /shared-data/repo
go test ./... -v > test-results.txt
cat test-results.txt
go test ./... -v
volumeMounts:
- name: shared-data
mountPath: /shared-data
@ -144,7 +144,7 @@ spec:
args:
- |
cd /shared-data/repo
golangci-lint run ./... --out-format=json --timeout 5m --issues-exit-code 1
golangci-lint run ./... --out-format=json --timeout 5m --issues-exit-code 1
volumeMounts:
- name: shared-data
mountPath: /shared-data