forked from myxyzpai/k8s-oversold
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
39 lines (28 loc) · 885 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
FROM golang:1.16-alpine AS builder
ENV GO111MODULE on
ENV SRC_PATH ${GOPATH}/src/github.com/mritd/goadmission
WORKDIR ${SRC_PATH}
COPY . .
RUN set -ex \
&& apk add git \
&& export BUILD_VERSION=$(cat /proc/version) \
&& export BUILD_DATE=$(date "+%F %T") \
&& export COMMIT_SHA1=$(git rev-parse HEAD) \
&& go install -ldflags \
"-X 'main.version=${BUILD_VERSION}' \
-X 'main.buildDate=${BUILD_DATE}' \
-X 'main.commitID=${COMMIT_SHA1}'"
FROM alpine
ARG TZ="Asia/Shanghai"
ENV TZ ${TZ}
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LANGUAGE en_US:en
RUN set -ex \
&& apk add bash tzdata ca-certificates \
&& ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone \
&& rm -rf /var/cache/apk/*
COPY --from=builder /go/bin/goadmission /goadmission
ENTRYPOINT ["/goadmission"]
CMD ["--help"]