mirror of
https://github.com/cedar2025/hysteria.git
synced 2025-06-08 13:29:56 +00:00
chore(dockerfile): auto env from git repo
auto env from git repo Signed-off-by: mritd <mritd@linux.com>
This commit is contained in:
parent
91cb3f8ef7
commit
71f3583deb
13
Dockerfile
13
Dockerfile
@ -2,21 +2,11 @@ FROM golang:alpine AS builder
|
|||||||
|
|
||||||
LABEL maintainer="mritd <mritd@linux.com>"
|
LABEL maintainer="mritd <mritd@linux.com>"
|
||||||
|
|
||||||
# The following parameters are used to set compilation information(such as compilation time,
|
|
||||||
# commit id, etc.). Use "docker build --build-arg VERSION=1.1.1 ..." to set these parameters.
|
|
||||||
# These parameters can be set automatically through CI Server.
|
|
||||||
ARG VERSION="Unknown"
|
|
||||||
ARG COMMIT="Unknown"
|
|
||||||
ARG TIMESTAMP="Unknown"
|
|
||||||
|
|
||||||
# GOPROXY is disabled by default, use:
|
# GOPROXY is disabled by default, use:
|
||||||
# docker build --build-arg GOPROXY="https://goproxy.io" ...
|
# docker build --build-arg GOPROXY="https://goproxy.io" ...
|
||||||
# to enable GOPROXY.
|
# to enable GOPROXY.
|
||||||
ARG GOPROXY=""
|
ARG GOPROXY=""
|
||||||
|
|
||||||
ENV VERSION ${VERSION}
|
|
||||||
ENV COMMIT ${COMMIT}
|
|
||||||
ENV TIMESTAMP ${TIMESTAMP}
|
|
||||||
ENV GOPROXY ${GOPROXY}
|
ENV GOPROXY ${GOPROXY}
|
||||||
|
|
||||||
COPY . /go/src/github.com/tobyxdd/hysteria
|
COPY . /go/src/github.com/tobyxdd/hysteria
|
||||||
@ -24,6 +14,9 @@ COPY . /go/src/github.com/tobyxdd/hysteria
|
|||||||
WORKDIR /go/src/github.com/tobyxdd/hysteria/cmd
|
WORKDIR /go/src/github.com/tobyxdd/hysteria/cmd
|
||||||
|
|
||||||
RUN set -ex \
|
RUN set -ex \
|
||||||
|
&& export VERSION=$(git describe --tags) \
|
||||||
|
&& export COMMIT=$(git rev-parse HEAD) \
|
||||||
|
&& export TIMESTAMP=$(date "+%F %T") \
|
||||||
&& go build -o /go/bin/hysteria -ldflags \
|
&& go build -o /go/bin/hysteria -ldflags \
|
||||||
"-w -s -X 'main.appVersion=${VERSION}' \
|
"-w -s -X 'main.appVersion=${VERSION}' \
|
||||||
-X 'main.appCommit=${COMMIT}' \
|
-X 'main.appCommit=${COMMIT}' \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user