From fb8c1a053ec39630eace696add5d4c8424b5551f Mon Sep 17 00:00:00 2001 From: Lucas TESSON Date: Wed, 10 Apr 2024 08:57:32 +0200 Subject: [PATCH] ci: build Dockerfile with goreleaser --- .goreleaser.yaml | 17 ++++++++++++++++- Dockerfile | 17 +---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 91681a7..cfdc9bd 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,5 +1,20 @@ +before: + hooks: + - go mod tidy + +gomod: + proxy: true + builds: - - skip: true + - env: + - CGO_ENABLED=0 + main: ./cmd/ctfd-setup + mod_timestamp: "{{ .CommitTimestamp }}" + goos: + - linux + goarch: + - amd64 + binary: "{{ .ProjectName }}" dockers: - image_templates: diff --git a/Dockerfile b/Dockerfile index ac488f4..2a25042 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,3 @@ -# Build stage -FROM golang:1.22.2@sha256:c4fb952e712efd8f787bcd8e53fd66d1d83b7dc26adabc218e9eac1dbf776bdf AS builder - -WORKDIR /go/src -COPY go.mod go.sum ./ -RUN go mod download - -COPY . . - -ENV CGO_ENABLED=0 -RUN go build -o /go/bin/ctfd-setup cmd/ctfd-setup/main.go - - - -# Prod stage FROM scratch -COPY --from=builder /go/bin/ctfd-setup /ctfd-setup +COPY ctfd-setup / ENTRYPOINT [ "/ctfd-setup" ]