-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
38 lines (28 loc) · 889 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
FROM golang:alpine AS builder
ENV SRC_PATH ${GOPATH}/src/joylive-injector
WORKDIR ${SRC_PATH}
COPY . .
RUN set -ex \
&& apk add git \
&& export BUILD_VERSION=$(cat version) \
&& export BUILD_DATE=$(date "+%F %T") \
&& export COMMIT_SHA1=$(git rev-parse HEAD) \
&& go mod tidy \
&& go install -trimpath -ldflags \
"-X 'main.version=${BUILD_VERSION}' \
-X 'main.buildDate=${BUILD_DATE}' \
-X 'main.commitID=${COMMIT_SHA1}' \
-w -s"
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/joylive-injector /joylive-injector
ENTRYPOINT ["/joylive-injector"]