-
Notifications
You must be signed in to change notification settings - Fork 25
/
Dockerfile
34 lines (24 loc) · 1.07 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
FROM golang:1.20 as builder
ARG PROTOC_VERSION=3.19.1
ARG PROTOC_ZIP=protoc-${PROTOC_VERSION}-linux-x86_64.zip
RUN apt-get update && apt-get install -y unzip
RUN curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP} \
&& unzip -o ${PROTOC_ZIP} -d /usr/local bin/protoc \
&& rm -f ${PROTOC_ZIP} \
&& apt-get autoclean && apt-get clean \
&& go install github.com/go-task/task/v3/cmd/task@latest
WORKDIR /app/
COPY . .
RUN task download && task build
FROM alpine:3.14
ENV TZ=Asia/Shanghai
ENV ZONEINFO=/usr/local/go/lib/time/zoneinfo.zip
WORKDIR /app/
COPY --from=builder /usr/local/go/lib/time/zoneinfo.zip /usr/local/go/lib/time/zoneinfo.zip
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /app/.air.conf.example /app/.air.conf
COPY --from=builder /app/etc /app/etc
COPY --from=builder /app/etc/config.yaml.example /app/etc/config.yaml
COPY --from=builder /app/assets /app/assets
COPY --from=builder /app/bin/app /app/bin/app
CMD ["./bin/app", "server"]