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

View File

@@ -14,8 +14,8 @@ ADD go.mod .
ADD go.sum . ADD go.sum .
RUN go mod download RUN go mod download
COPY . . 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}} FROM {{.BaseImage}}
@@ -25,8 +25,10 @@ COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certifi
ENV TZ {{.Timezone}} ENV TZ {{.Timezone}}
{{end}} {{end}}
WORKDIR /app WORKDIR /app
COPY --from=builder /app/{{.ExeFile}} /app/{{.ExeFile}}{{if .Argument}} COPY --from=builder /app/{{.ExeFile}} /app/{{.ExeFile}}
COPY --from=builder /app/etc /app/etc{{end}} {{if .Argument}}COPY {{.GoRelPath}}/etc /app/etc
{{end}}
{{if .HasPort}} {{if .HasPort}}
EXPOSE {{.Port}} EXPOSE {{.Port}}
{{end}} {{end}}