From ecae14339b1951dfef583506f3c55743fd31af9c Mon Sep 17 00:00:00 2001 From: Clark McCauley Date: Fri, 24 Nov 2023 00:20:23 -0700 Subject: [PATCH] Added the Dockers --- .goreleaser.yaml | 21 ++++++++++++++++++++- cmd/cloudcore-server/Dockerfile | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 cmd/cloudcore-server/Dockerfile diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 77b02ef..ce38831 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -12,6 +12,15 @@ 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: + - linux_amd64 nfpms: - id: cloudcored-linux package_name: cloudcored @@ -30,4 +39,14 @@ nfpms: # preremove: scripts/linux/preremove.sh # postremove: scripts/linux/postremove.sh # Whether to enable the size reporting or not. -report_sizes: true \ No newline at end of file + +dockers: + # Server + - id: cloudcore-server + goos: linux + goarch: amd64 + ids: + - cloudcore-server + dockerfile: ./cmd/cloudcore-server/Dockerfile + +report_sizes: true diff --git a/cmd/cloudcore-server/Dockerfile b/cmd/cloudcore-server/Dockerfile new file mode 100644 index 0000000..1acac0d --- /dev/null +++ b/cmd/cloudcore-server/Dockerfile @@ -0,0 +1,20 @@ +FROM golang:1.21-alpine AS builder + +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 + +ENTRYPOINT ["cloudcore"] \ No newline at end of file