chore: reduce the docker image size (#1633)
* chore: reduce the docker image size * chore: format dockerfile
This commit is contained in:
@@ -15,6 +15,8 @@ LABEL stage=gobuilder
|
||||
ENV CGO_ENABLED 0
|
||||
ENV GOOS linux
|
||||
{{if .Chinese}}ENV GOPROXY https://goproxy.cn,direct
|
||||
{{end}}{{if .HasTimezone}}
|
||||
RUN apk update --no-cache && apk add --no-cache tzdata
|
||||
{{end}}
|
||||
WORKDIR /build
|
||||
|
||||
@@ -28,9 +30,10 @@ COPY . .
|
||||
|
||||
FROM alpine
|
||||
|
||||
RUN apk update --no-cache && apk add --no-cache ca-certificates tzdata
|
||||
ENV TZ Asia/Shanghai
|
||||
|
||||
RUN apk update --no-cache && apk add --no-cache ca-certificates
|
||||
{{if .HasTimezone}}COPY --from=builder /usr/share/zoneinfo/{{.Timezone}} /usr/share/zoneinfo/{{.Timezone}}
|
||||
ENV TZ {{.Timezone}}
|
||||
{{end}}
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/{{.ExeFile}} /app/{{.ExeFile}}{{if .Argument}}
|
||||
COPY --from=builder /app/etc /app/etc{{end}}
|
||||
|
||||
Reference in New Issue
Block a user