From 0d99c3f9425b4007d3a2c3d05ab31e0d84b85681 Mon Sep 17 00:00:00 2001 From: vcptr <51714622+vcptr@users.noreply.github.com> Date: Thu, 31 Oct 2019 11:20:06 +0800 Subject: [PATCH 1/3] add abpath to user-package --- Dockerfile | 17 +++++++++++++++++ release/user-package.sh | 18 +++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..847868aa1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +############################ +# STEP 1 build executable binary +############################ +FROM golang:alpine AS builder +RUN apk update && apk add --no-cache git bash wget +WORKDIR /go/src/v2ray.com/core +RUN git clone --progress --depth=1 --branch dockerdev https://github.com/v2fly/v2ray-core.git . && \ + bash -x ./release/user-package.sh nosource noconf abpathtgz=/tmp/v2ray.tgz +############################ +# STEP 2 build a small image +############################ +FROM alpine +COPY --from=builder /tmp/v2ray.tgz /tmp +RUN apk update && apk add ca-certificates && \ + mkdir -p /usr/bin/v2ray && \ + tar xvfz /tmp/v2ray.tgz -C /usr/bin/v2ray +ENTRYPOINT ["/usr/bin/v2ray/v2ray"] diff --git a/release/user-package.sh b/release/user-package.sh index 06c32c8a4..37265ff4b 100755 --- a/release/user-package.sh +++ b/release/user-package.sh @@ -86,6 +86,14 @@ packtgz() { echo ">>> Generated: $(basename $PKG)" } +packtgzAbPath() { + local ABPATH="$1" + echo ">>> Generating tgz package at $ABPATH" + pushd $TMP + tar cvfz $ABPATH . + echo ">>> Generated: $ABPATH" +} + pkg=zip nosource=0 @@ -127,6 +135,9 @@ case $arg in tgz) pkg=tgz ;; + abpathtgz=*) + pkg=${arg##abpathtgz=} + ;; esac done @@ -147,11 +158,12 @@ fi if [[ $pkg == "zip" ]]; then packzip +elif [[ $pkg == "tgz" ]]; then + packtgz +else + packtgzAbPath $pkg fi -if [[ $pkg == "tgz" ]]; then - packtgz -fi cleanup From 82745be6fd599002fc7c49388bc531c1dcecc653 Mon Sep 17 00:00:00 2001 From: vcptr <51714622+vcptr@users.noreply.github.com> Date: Thu, 31 Oct 2019 11:44:57 +0800 Subject: [PATCH 2/3] adjust args --- Dockerfile | 4 ++-- release/user-package.sh | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 847868aa1..3424bfd68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,8 @@ FROM golang:alpine AS builder RUN apk update && apk add --no-cache git bash wget WORKDIR /go/src/v2ray.com/core -RUN git clone --progress --depth=1 --branch dockerdev https://github.com/v2fly/v2ray-core.git . && \ - bash -x ./release/user-package.sh nosource noconf abpathtgz=/tmp/v2ray.tgz +RUN git clone --progress --depth=1 https://github.com/v2fly/v2ray-core.git . && \ + bash ./release/user-package.sh nosource noconf abpathtgz=/tmp/v2ray.tgz ############################ # STEP 2 build a small image ############################ diff --git a/release/user-package.sh b/release/user-package.sh index 37265ff4b..00ed3ff91 100755 --- a/release/user-package.sh +++ b/release/user-package.sh @@ -138,6 +138,12 @@ case $arg in abpathtgz=*) pkg=${arg##abpathtgz=} ;; + codename=*) + CODENAME=${arg##codename=} + ;; + buildname=*) + BUILDNAME=${arg##buildname=} + ;; esac done @@ -146,6 +152,8 @@ if [[ $nosource != 1 ]]; then fi export GOOS GOARCH +echo "Build ARGS: GOOS=${GOOS} GOARCH=${GOARCH} CODENAME=${CODENAME} BUILDNAME=${BUILDNAME}" +echo "PKG ARGS: pkg=${pkg}" build_v2 if [[ $nodat != 1 ]]; then From bd08ba6b15e3147681bc71dc3389f2b30c0a15a3 Mon Sep 17 00:00:00 2001 From: vcptr <51714622+vcptr@users.noreply.github.com> Date: Tue, 26 Nov 2019 13:50:25 +0800 Subject: [PATCH 3/3] remove dockerfile --- Dockerfile | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 3424bfd68..000000000 --- a/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -############################ -# STEP 1 build executable binary -############################ -FROM golang:alpine AS builder -RUN apk update && apk add --no-cache git bash wget -WORKDIR /go/src/v2ray.com/core -RUN git clone --progress --depth=1 https://github.com/v2fly/v2ray-core.git . && \ - bash ./release/user-package.sh nosource noconf abpathtgz=/tmp/v2ray.tgz -############################ -# STEP 2 build a small image -############################ -FROM alpine -COPY --from=builder /tmp/v2ray.tgz /tmp -RUN apk update && apk add ca-certificates && \ - mkdir -p /usr/bin/v2ray && \ - tar xvfz /tmp/v2ray.tgz -C /usr/bin/v2ray -ENTRYPOINT ["/usr/bin/v2ray/v2ray"]