Skip to content

Commit ad291da

Browse files
authored
chore: format Dockerfile template (#4496)
1 parent 13746a3 commit ad291da

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tools/goctl/docker/docker.tpl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ LABEL stage=gobuilder
44

55
ENV CGO_ENABLED 0
66
{{if .Chinese}}ENV GOPROXY https://goproxy.cn,direct
7+
78
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
8-
{{end}}{{if .HasTimezone}}
9+
{{- end}}{{if .HasTimezone}}
910
RUN apk update --no-cache && apk add --no-cache tzdata
10-
{{end}}
11+
{{- end}}
12+
1113
WORKDIR /build
1214

1315
ADD go.mod .
@@ -21,14 +23,15 @@ RUN go build -ldflags="-s -w" -o /app/{{.ExeFile}} {{.GoMainFrom}}
2123
FROM {{.BaseImage}}
2224

2325
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
24-
{{if .HasTimezone}}COPY --from=builder /usr/share/zoneinfo/{{.Timezone}} /usr/share/zoneinfo/{{.Timezone}}
26+
{{if .HasTimezone -}}
27+
COPY --from=builder /usr/share/zoneinfo/{{.Timezone}} /usr/share/zoneinfo/{{.Timezone}}
2528
ENV TZ {{.Timezone}}
2629
{{end}}
2730
WORKDIR /app
2831
COPY --from=builder /app/{{.ExeFile}} /app/{{.ExeFile}}
29-
{{if .Argument}}COPY {{.GoRelPath}}/etc /app/etc
30-
{{end}}
31-
32+
{{if .Argument -}}
33+
COPY {{.GoRelPath}}/etc /app/etc
34+
{{- end}}
3235
{{if .HasPort}}
3336
EXPOSE {{.Port}}
3437
{{end}}

0 commit comments

Comments
 (0)