-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea8f739
commit b55c21c
Showing
2 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
ARG BUILD_IMAGE=golang:alpine | ||
FROM ${BUILD_IMAGE} AS builder | ||
|
||
ENV SRC_PATH ${GOPATH}/src/joylive-injector | ||
|
||
WORKDIR ${SRC_PATH} | ||
|
||
COPY . . | ||
|
||
ENV GO111MODULE=on | ||
ENV GOPROXY http://jdos-goproxy.jdcloud.com,direct | ||
ENV GOPRIVATE "" | ||
|
||
RUN set -ex \ | ||
&& 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" | ||
|
||
ARG RUNTIME_IMAGE=alpine | ||
FROM ${RUNTIME_IMAGE} | ||
|
||
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 \ | ||
&& 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"] |