From 88d933078f84c651406208c596226f33d2ca334b Mon Sep 17 00:00:00 2001 From: iamjooon2 Date: Sat, 14 Sep 2024 01:41:35 +0900 Subject: [PATCH] test --- Dockerfile | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 943bcad..2cbb5e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,24 @@ -FROM golang:1.22.5 AS builder +FROM golang:alpine AS builder -WORKDIR /app +ENV GO111MODULE=on \ + CGO_ENABLED=0 \ + GOOS=linux \ + GOARCH=amd64 -COPY go.mod go.sum ./ +WORKDIR /build -RUN go mod download +COPY go.mod go.sum ./cmd/main.go ./ -COPY . . +RUN go mod download +RUN go build -o techbloghub-server . -RUN CGO_ENABLED=0 GOOS=linux go build -o myapp . +WORKDIR /dist -FROM alpine:latest +RUN cp /build/techbloghub-server . -WORKDIR /root/ +FROM scratch -COPY --from=builder /app/myapp . +COPY --from=builder /dist/techbloghub-server /techbloghub-server -CMD ["./myapp"] +EXPOSE 8080 +ENTRYPOINT ["/techbloghub-server"] \ No newline at end of file