From 1b854779f7ce04a4488b223a3e98fe769fa6d685 Mon Sep 17 00:00:00 2001 From: zizifn <1803942+zizifn@users.noreply.github.com> Date: Sat, 12 Dec 2020 22:46:23 +0800 Subject: [PATCH] feat: add Heroku --- .github/workflows/heroku.yml | 23 +++++++++++++++++++ Dockerfile | 8 +++++++ app.json | 16 +++++++++++++ configure.sh | 44 ++++++++++++++++++++++++++++++++++++ heroku.yml | 3 +++ 5 files changed, 94 insertions(+) create mode 100644 .github/workflows/heroku.yml create mode 100644 Dockerfile create mode 100644 app.json create mode 100644 configure.sh create mode 100644 heroku.yml diff --git a/.github/workflows/heroku.yml b/.github/workflows/heroku.yml new file mode 100644 index 0000000..3b264a2 --- /dev/null +++ b/.github/workflows/heroku.yml @@ -0,0 +1,23 @@ +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: akhileshns/heroku-deploy@v3.7.8 # This is the action + with: + heroku_api_key: ${{secrets.HEROKU_API_KEY}} + heroku_app_name: ${{secrets.APP_NAME}} #Must be unique in Heroku + heroku_email: ${{secrets.EMAIL}} + usedocker: true + # docker_build_args: | + # NODE_ENV + # SECRET_KEY + env: + NODE_ENV: production + SECRET_KEY: ${{ secrets.MY_SECRET_KEY }} + UUID: ${{ secrets.HEROKU_V2RAY_UUID }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..73c2a60 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM alpine:3.5 + +ADD configure.sh /configure.sh + +RUN apk add --no-cache ca-certificates curl unzip \ + && chmod +x /configure.sh + +CMD /configure.sh diff --git a/app.json b/app.json new file mode 100644 index 0000000..37ddabb --- /dev/null +++ b/app.json @@ -0,0 +1,16 @@ +{ + "name": "V2Ray", + "description": "Deploy V2ray on Heroku.", + "keywords": [ + "V2Ray" + ], + "env": { + "UUID": { + "description": "V2Ray UUID", + "value": "uuid" + } + }, + "website": "https://ibcl.us/Heroku-V2Ray_20191014/", + "repository": "https://github.com/bclswl0827/v2ray-heroku", + "stack": "container" +} \ No newline at end of file diff --git a/configure.sh b/configure.sh new file mode 100644 index 0000000..1184929 --- /dev/null +++ b/configure.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +# Download and install V2Ray +mkdir /tmp/v2ray +curl -L -H "Cache-Control: no-cache" -o /tmp/v2ray/v2ray.zip https://github.com/v2fly/v2ray-core/releases/latest/download/v2ray-linux-64.zip +unzip /tmp/v2ray/v2ray.zip -d /tmp/v2ray +install -m 755 /tmp/v2ray/v2ray /usr/local/bin/v2ray +install -m 755 /tmp/v2ray/v2ctl /usr/local/bin/v2ctl + +# Remove temporary directory +rm -rf /tmp/v2ray + +# V2Ray new configuration +install -d /usr/local/etc/v2ray +cat << EOF > /usr/local/etc/v2ray/config.json +{ + "inbounds": [ + { + "port": $PORT, + "protocol": "vmess", + "settings": { + "clients": [ + { + "id": "$UUID", + "alterId": 64 + } + ], + "disableInsecureEncryption": true + }, + "streamSettings": { + "network": "ws" + } + } + ], + "outbounds": [ + { + "protocol": "freedom" + } + ] +} +EOF + +# Run V2Ray +/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json diff --git a/heroku.yml b/heroku.yml new file mode 100644 index 0000000..8eec25b --- /dev/null +++ b/heroku.yml @@ -0,0 +1,3 @@ +build: + docker: + web: Dockerfile