From 3fe91202e36f636e48038700bc4e3085d072c5d7 Mon Sep 17 00:00:00 2001 From: Clark McCauley Date: Fri, 24 Nov 2023 00:32:50 -0700 Subject: [PATCH] Fixing the Dockers --- .goreleaser.yaml | 15 +++++++++++++++ cmd/cloudcore-server/Dockerfile | 19 ++----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 5c8f77b..f2c300e 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -12,6 +12,19 @@ builds: - linux_amd64 - linux_arm64 - linux_arm_5 + - id: cloudcore-server + main: ./cmd/cloudcore-server + binary: cloudcore + ldflags: + - -s -w -X github.com/clarkmcc/cloudcore/pkg/version.Version={{.Version}} -X github.com/clarkmcc/cloudcore/pkg/version.Hash={{.Commit}} + env: + - CGO_ENABLED=0 + targets: + - darwin_amd64 + - darwin_arm64 + - linux_amd64 + - linux_arm64 + - linux_arm_5 nfpms: - id: cloudcored-linux package_name: cloudcored @@ -36,6 +49,8 @@ dockers: - id: cloudcore-server image_templates: - clarkmcc/cloudcore + ids: + - cloudcore-server goos: linux goarch: amd64 dockerfile: ./cmd/cloudcore-server/Dockerfile diff --git a/cmd/cloudcore-server/Dockerfile b/cmd/cloudcore-server/Dockerfile index 1acac0d..9940654 100644 --- a/cmd/cloudcore-server/Dockerfile +++ b/cmd/cloudcore-server/Dockerfile @@ -1,20 +1,5 @@ -FROM golang:1.21-alpine AS builder +FROM scratch -WORKDIR /root - -COPY go.mod /root/go.mod -COPY go.sum /root/go.sum -RUN go mod download - -COPY cmd /root/cmd -COPY pkg /root/pkg -COPY app/backend /root/app/backend -COPY internal /root/internal - -RUN go build -o cloudcore ./cmd/cloudcore-server - -FROM alpine:latest AS runtime - -COPY --from=builder /root/cloudcore /usr/bin/cloudcore +COPY cloudcore /cloudcore ENTRYPOINT ["cloudcore"] \ No newline at end of file