1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 10:08:15 -05:00

Merge pull request #91 from CzBiX/docker

generate server config on first run
This commit is contained in:
Darien Raymond 2016-02-22 11:49:15 +01:00
commit 5c8ac0d6e0
5 changed files with 32 additions and 13 deletions

View File

@ -1,10 +1,14 @@
FROM golang:latest
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
RUN go get -u github.com/v2ray/v2ray-core \
&& rm -f $GOPATH/bin/build \
&& go install github.com/v2ray/v2ray-core/tools/build \
&& build \
&& rm -rf pkg src
EXPOSE 27183
ADD server-cfg.json /go/server-cfg.json
CMD /go/bin/v2ray-custom-linux-64/v2ray --config="/go/server-cfg.json"
COPY gen-server-cfg.sh /go/gen-server-cfg.sh
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/go/bin/v2ray-custom-linux-64/v2ray", "--config=/go/server-cfg.json"]

View File

@ -16,11 +16,21 @@ Then spin up a v2ray instance with:
./run.sh
```
The build script will generate a server config file with random user id. You
can get it from `server-cfg.json`.
The docker image will generate a server config file with random user id on first run.
You can get see it with:
```bash
docker logs v2ray
```
You can also specify config file by manual with:
```bash
docker run -d --name=v2ray -p 27183:27183 -v /config/file.json:/go/server-config.json $USER/v2ray
```
To tail the access log, run:
```bash
docker exec v2ray tail -F /v2ray/logs/access.log
docker exec v2ray tail -F /go/access.log
```

View File

@ -1,7 +1,3 @@
#!/bin/bash
if [ ! -e server-cfg.json ]; then
./gen-server-config.sh
fi
docker build --rm=true --tag=$USER/v2ray ./

View File

@ -0,0 +1,8 @@
#!/bin/bash
set -e
if [ ! -e "server-cfg.json" ]; then
./gen-server-cfg.sh
fi
exec "$@"

View File

@ -7,6 +7,7 @@ rand_str () {
}
ID="$(rand_str 8)-$(rand_str 4)-$(rand_str 4)-$(rand_str 4)-$(rand_str 12)"
echo "Generated client ID: $ID"
cat <<EOF > server-cfg.json
{