From e46d16e2b3f53cc9ab506a52ced88e8dcace8fe6 Mon Sep 17 00:00:00 2001 From: iamjooon2 Date: Sat, 14 Sep 2024 03:40:53 +0900 Subject: [PATCH] =?UTF-8?q?=E3=85=85=E3=84=B7=E3=84=B4=E3=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index ad17832..00d2d69 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,18 @@ # syntax=docker/dockerfile:1 # Build the application from source -FROM golang:1.22 AS build-stage +FROM golang:1.22.5 AS build-stage WORKDIR /app COPY go.mod go.sum ./ -RUN go mod download -COPY *.go ./ +RUN go mod tidy -RUN CGO_ENABLED=0 GOOS=linux go build -o /techbloghub +COPY . . -# Run the tests in the container -FROM build-stage AS run-test-stage -RUN go test -v ./... - -# Deploy the application binary into a lean image -FROM gcr.io/distroless/base-debian11 AS build-release-stage - -WORKDIR / - -COPY --from=build-stage /techbloghub /techbloghub +RUN go build -o main ./main.go EXPOSE 8080 -USER nonroot:nonroot - -ENTRYPOINT ["//techbloghub"] +ENTRYPOINT ["/techbloghub"]