From 036d267abf8b672281cf25fb2378ca17b28313a4 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Thu, 18 Jul 2024 14:44:20 +0200 Subject: [PATCH] Revert "back to nix" This reverts commit 43af5f1a763ff75df69b9c03b61b1b43519477c3. --- .github/workflows/ci.yml | 4 ++++ Dockerfile | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 Dockerfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7dac3d..680570d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,3 +33,7 @@ jobs: - name: Run tests run: | go test ./... + + - name: Build Docker image + run: | + docker build -t rentease . \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..39c2655 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM golang:1.22-alpine AS builder + +RUN apk add --no-cache \ + git \ + build-base + +WORKDIR /app + +COPY go.mod go.sum ./ +RUN go mod download +COPY . . + +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /app/dist/rentease main.go + +FROM scratch + +COPY --from=builder /app/dist/rentease /app/dist/rentease + +WORKDIR /app + +EXPOSE 8000 + +ENTRYPOINT ["/app/dist/rentease"] \ No newline at end of file