From 6466d1fb0d789331e49b5863e82297096c3e46d0 Mon Sep 17 00:00:00 2001 From: yoan <536464346@qq.com> Date: Fri, 30 Aug 2024 23:47:41 +0800 Subject: [PATCH] To optimize Docker image size. --- Dockerfile_build | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Dockerfile_build b/Dockerfile_build index 64d19d26..23b27630 100644 --- a/Dockerfile_build +++ b/Dockerfile_build @@ -1,8 +1,16 @@ -FROM ubuntu:latest +FROM golang:1.22-alpine as builder +WORKDIR /app + +COPY ../. /app/ + +RUN go build -o certimate + + +FROM alpine:latest WORKDIR /app -COPY certimate /app/certimate +COPY --from=builder /app/certimate . ENTRYPOINT ["./certimate", "serve", "--http", "0.0.0.0:8090"] \ No newline at end of file