forked from OldSmokeGun/go-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
32 lines (22 loc) · 994 Bytes
/
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
FROM golang:1.19 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
WORKDIR /app/
COPY . .
RUN make download && make proto && make 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/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"]