add docker builds

This commit is contained in:
Maël Gramain 2025-03-02 15:10:35 +01:00
commit d0126c97ff
4 changed files with 51 additions and 2 deletions

32
.woodpecker/docker.yaml Normal file
View file

@ -0,0 +1,32 @@
steps:
- name: publish_image
image: woodpeckerci/plugin-docker-buildx
settings:
repo: git.gnous.eu/${CI_REPO_OWNER}/forgejo
dockerfile: Dockerfile
platforms: linux/amd64
registry: https://git.gnous.eu
tag: ${CI_COMMIT}
username:
from_secret: docker_username
password:
from_secret: docker_password
when:
branch: ${CI_REPO_DEFAULT_BRANCH}
event: push
- name: publish_image_tag
image: woodpeckerci/plugin-docker-buildx
settings:
repo: git.gnous.eu/${CI_REPO_OWNER}/forgejo
dockerfile: Dockerfile
platforms: linux/amd64
registry: https://git.gnous.eu
tags:
- ${CI_COMMIT_TAG##v} # Remove v from tag
- stable
username:
from_secret: docker_username
password:
from_secret: docker_password
when:
event: tag

View file

@ -1,6 +1,6 @@
steps:
lint:
image: golang:1.22
image: golang:1.24
commands:
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- golangci-lint run

View file

@ -1,6 +1,6 @@
steps:
- name: Build
image: golang:1.22
image: golang:1.24
commands:
- go mod download
- go get

17
Dockerfile Normal file
View file

@ -0,0 +1,17 @@
FROM golang:1.24 AS builder
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH
WORKDIR /app/
ADD . .
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" -o epee main.go
FROM scratch
WORKDIR /app/
COPY --from=builder /app/epee /app/epee
EXPOSE 5900
ENTRYPOINT ["/app/epee"]