From 7e48e83447b2b8e5d2a2cbb0a46ab1926b0c7495 Mon Sep 17 00:00:00 2001 From: agungdwiprasetyo Date: Wed, 3 Jan 2024 11:18:48 +0700 Subject: [PATCH] generator: update docker template --- cmd/candi/template_etc.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/candi/template_etc.go b/cmd/candi/template_etc.go index cb4ead23..919611cf 100644 --- a/cmd/candi/template_etc.go +++ b/cmd/candi/template_etc.go @@ -2,7 +2,7 @@ package main const ( dockerfileTemplate = `# Stage 1 -FROM golang:1.18.4-alpine3.16 AS dependency_builder +FROM golang:1.21.5-alpine3.19 AS dependency_builder WORKDIR /go/src ENV GO111MODULE=on @@ -24,7 +24,7 @@ COPY . . RUN go build -o bin # Stage 3 -FROM alpine:latest +FROM alpine:3.19 ARG BUILD_NUMBER RUN apk --no-cache add ca-certificates tzdata @@ -61,7 +61,7 @@ docker: docker build -t {{.ServiceName}}:latest . run-container: - docker run --name={{.ServiceName}} --network="host" -d {{.ServiceName}} + docker run --rm --name={{.ServiceName}} --network="host" -d {{.ServiceName}} clear-docker: docker rm -f {{.ServiceName}} @@ -348,7 +348,7 @@ $ make migration service={{service_name}} down "```\n" dockerfileMonorepoTemplate = `# Stage 1 -FROM golang:1.18.4-alpine3.16 AS dependency_builder +FROM golang:1.21.5-alpine3.19 AS dependency_builder WORKDIR /go/src ENV GO111MODULE=on @@ -374,7 +374,7 @@ COPY go.sum . RUN go build -o bin services/$SERVICE_NAME/*.go # Stage 3 -FROM alpine:latest +FROM alpine:3.19 ARG BUILD_NUMBER ARG SERVICE_NAME @@ -430,7 +430,7 @@ docker: check docker build --build-arg SERVICE_NAME=$(service) -t $(service):latest . run-container: check - docker run --name=$(service) --network="host" -d $(service) + docker run --rm --name=$(service) --network="host" -d $(service) clear-docker: check docker rm -f $(service)