From 76cdfd05482b9fbf9cd30c396df809e28f047d40 Mon Sep 17 00:00:00 2001 From: gyuyoung Date: Mon, 29 Jul 2024 22:36:38 +0900 Subject: [PATCH] Reduce image size of modelmgmtservice - Updated stage1 to build modelmgmtservice golang binary - Added stage2 to run modelmgmtservice golang binary with compact environment - Change alpine tag from 'latest' to '3.20' for fixing development environment Issue-ID: AIMLFW-116 Change-Id: Idce95bef25c4505f0edb0a810bfebdc96b89283a Signed-off-by: gyuyoung --- Dockerfile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4d4d951..9a0d75f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ # # ================================================================================== #Base Image -FROM golang:1.21 +FROM golang:1.21-alpine AS builder # location in the container ENV MME_DIR /home/app/ @@ -32,8 +32,17 @@ RUN LOG_FILE_NAME=testing.log go test ./... #Build all packages from current dir into bin RUN go build -o mme_bin . +FROM alpine:3.20 + +RUN apk update && apk add bash +RUN apk add --no-cache bash + +WORKDIR /app + +COPY --from=builder /home/app/mme_bin . + #Start the app -ENTRYPOINT [ "sh", "-c", "${MME_DIR}/mme_bin"] +ENTRYPOINT ["/app/mme_bin"] #Expose the ports for external communication EXPOSE 8082 -- 2.16.6