mirror of https://github.com/v2ray/v2ray-core
add: docker file
parent
3bbb1c6a93
commit
ffa2f49621
|
@ -0,0 +1,23 @@
|
||||||
|
FROM phusion/baseimage
|
||||||
|
|
||||||
|
ENV GOPATH /v2ray
|
||||||
|
ENV PATH $PATH:/usr/local/go/bin
|
||||||
|
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y git
|
||||||
|
RUN apt-get clean
|
||||||
|
|
||||||
|
RUN mkdir -p /v2ray/logs
|
||||||
|
RUN curl -o /go.tar.gz https://storage.googleapis.com/golang/go1.5.2.linux-amd64.tar.gz
|
||||||
|
RUN tar -C /usr/local -xzf /go.tar.gz
|
||||||
|
RUN rm /go.tar.gz
|
||||||
|
|
||||||
|
|
||||||
|
RUN go get -u github.com/v2ray/v2ray-core
|
||||||
|
RUN rm -f $GOPATH/bin/build
|
||||||
|
RUN go install github.com/v2ray/v2ray-core/tools/build
|
||||||
|
RUN $GOPATH/bin/build
|
||||||
|
|
||||||
|
EXPOSE 27183
|
||||||
|
ADD server-cfg.json /v2ray/server-cfg.json
|
||||||
|
CMD /v2ray/bin/v2ray-custom-linux-64/v2ray --config="/v2ray/server-cfg.json"
|
|
@ -0,0 +1,26 @@
|
||||||
|
Docker build for v2ray
|
||||||
|
=======================
|
||||||
|
|
||||||
|
Usage
|
||||||
|
-----
|
||||||
|
|
||||||
|
To build the image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./build.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Then spin up a v2ray instance with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./run.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
The build script will generate a server config file with random user id. You
|
||||||
|
can get it from `server-cfg.json`.
|
||||||
|
|
||||||
|
To tail the access log, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker exec v2ray tail -F /v2ray/logs/access.log
|
||||||
|
```
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ ! -e server-cfg.json ]; then
|
||||||
|
./gen-server-config.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker build --rm=true --tag=$USER/v2ray ./
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
PORT=27183
|
||||||
|
|
||||||
|
rand_str () {
|
||||||
|
cat /dev/urandom | tr -dc 'a-f0-9' | fold -w $1 | head -n 1
|
||||||
|
}
|
||||||
|
|
||||||
|
ID="$(rand_str 8)-$(rand_str 4)-$(rand_str 4)-$(rand_str 4)-$(rand_str 12)"
|
||||||
|
|
||||||
|
cat <<EOF > server-cfg.json
|
||||||
|
{
|
||||||
|
"port": $PORT,
|
||||||
|
"log" : {
|
||||||
|
"access": "/v2ray/logs/access.log"
|
||||||
|
},
|
||||||
|
"inbound": {
|
||||||
|
"protocol": "vmess",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{"id": "$ID"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outbound": {
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
docker run -d --name=v2ray -p 27183:27183/tcp $USER/v2ray
|
Loading…
Reference in New Issue