Update docker.tpl (#4495)

This commit is contained in:
lascyb 2024-12-14 00:08:38 +08:00 committed by GitHub
parent f03b13f632
commit 13746a3706
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,8 +14,8 @@ ADD go.mod .
ADD go.sum .
RUN go mod download
COPY . .
{{if .Argument}}COPY {{.GoRelPath}}/etc /app/etc
{{end}}RUN go build -ldflags="-s -w" -o /app/{{.ExeFile}} {{.GoMainFrom}}
RUN go build -ldflags="-s -w" -o /app/{{.ExeFile}} {{.GoMainFrom}}
FROM {{.BaseImage}}
@ -25,8 +25,10 @@ COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certifi
ENV TZ {{.Timezone}}
{{end}}
WORKDIR /app
COPY --from=builder /app/{{.ExeFile}} /app/{{.ExeFile}}{{if .Argument}}
COPY --from=builder /app/etc /app/etc{{end}}
COPY --from=builder /app/{{.ExeFile}} /app/{{.ExeFile}}
{{if .Argument}}COPY {{.GoRelPath}}/etc /app/etc
{{end}}
{{if .HasPort}}
EXPOSE {{.Port}}
{{end}}