diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 93d4043..d23d880 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,6 +9,7 @@ on: - "go.mod" - "go.sum" - ".goreleaser.yaml" + - "Dockerfile.goreleaser" - ".gitattributes" - ".traefik.yml" - "version.go" @@ -25,4 +26,5 @@ jobs: uses: lukaszraczylo/shared-actions/.github/workflows/go-release.yaml@main with: go-version: "1.26.x" + docker-enabled: true secrets: inherit diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 5d505d9..e028e4a 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,9 +1,36 @@ version: 2 -# Traefik plugins are source-only - no binary builds -# Traefik loads plugins via Yaegi interpreter at runtime +# Traefik loads the plugin from this repository's source under Yaegi, so the +# plugin form needs no binary. The build below is the standalone gateway +# (cmd/gateway), which runs behind a reverse proxy instead of inside Traefik. builds: - - skip: true + - id: llmgateway + main: ./cmd/gateway + binary: llmgateway + env: + - CGO_ENABLED=0 + - GOFLAGS=-mod=vendor + flags: + - -trimpath + ldflags: + - -s -w + - -X main.version={{ .Version }} + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + +archives: + - id: llmgateway + ids: + - llmgateway + formats: [tar.gz] + name_template: "llmgateway_v{{ .Version }}_{{ .Os }}_{{ .Arch }}" + files: + - LICENSE + - README.md # Source archive for GitHub releases, built with `git archive` under the # hood. `git archive` reads .gitattributes export-ignore at the archived @@ -60,3 +87,31 @@ signs: - "--yes" artifacts: checksum output: true + +dockers_v2: + - ids: + - llmgateway + images: + - "ghcr.io/lukaszraczylo/traefik-llmgateway" + tags: + - "{{ .Version }}" + - "latest" + platforms: + - linux/amd64 + - linux/arm64 + dockerfile: Dockerfile.goreleaser + labels: + "org.opencontainers.image.title": "llmgateway" + "org.opencontainers.image.version": "{{ .Version }}" + "org.opencontainers.image.source": "https://github.com/lukaszraczylo/traefik-llmgateway" + "org.opencontainers.image.description": "Standalone multi-provider LLM gateway, the compiled form of the traefik-llmgateway plugin" + "org.opencontainers.image.licenses": "MIT" + +docker_signs: + - cmd: cosign + artifacts: manifests + output: true + args: + - sign + - "${artifact}@${digest}" + - "--yes" diff --git a/Dockerfile.goreleaser b/Dockerfile.goreleaser new file mode 100644 index 0000000..3be11ae --- /dev/null +++ b/Dockerfile.goreleaser @@ -0,0 +1,10 @@ +# Image for the standalone gateway, built by GoReleaser (dockers_v2) from the +# binaries it already compiled: dist///llmgateway. `Dockerfile` +# builds the same image from source for local use (make docker-build). +FROM gcr.io/distroless/static-debian12:nonroot +ARG TARGETPLATFORM +COPY ${TARGETPLATFORM}/llmgateway /usr/local/bin/llmgateway +USER nonroot:nonroot +EXPOSE 8080 +ENTRYPOINT ["/usr/local/bin/llmgateway"] +CMD ["-config", "/etc/llmgateway/config.yaml"]