-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
41 lines (31 loc) · 913 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
33
34
35
36
37
38
39
40
41
################################
# builder
################################
FROM golang:1.15-alpine AS builder
RUN set -ex \
&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
&& apk update \
&& apk add --no-cache alpine-sdk git \
&& rm -rf /var/cache/apk/*
RUN mkdir -p /build
WORKDIR /build
COPY . .
ENV GOPROXY=https://goproxy.cn,direct \
GO111MODULE="auto"
RUN go mod download
ENV CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
RUN go build -o /build/esctl ./main.go
################################
# runtime
################################
FROM alpine:3.11
RUN set -ex \
&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
&& apk update \
&& apk add --no-cache ca-certificates tzdata bash \
&& rm -rf /var/cache/apk/*
ENV TZ=Asia/Shanghai
COPY --from=builder /build/esctl /usr/local/bin/
ENTRYPOINT [ "esctl" ]