commit 1ed2e1dd57e3962189bf8355307e977f828b3f6f Author: ge Date: Thu Dec 15 03:14:16 2022 +0300 init diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9217ac3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM alpine:3.17.0 +RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing shadowsocks-libev curl +RUN mkdir -pv /usr/share/shadowsocks-libev/plugins +RUN tag="$(curl -sSo /dev/null -w '%{redirect_url}' \ + https://github.com/shadowsocks/v2ray-plugin/releases/latest | \ + cut -d '/' -f 8)"; \ + curl -sSL https://github.com/shadowsocks/v2ray-plugin/releases/download/$tag/v2ray-plugin-linux-amd64-$tag.tar.gz | \ + tar xz -O > /usr/share/shadowsocks-libev/plugins/v2ray-plugin +RUN chmod +x /usr/share/shadowsocks-libev/plugins/v2ray-plugin + +ENV SERVER_HOST="${SERVER_HOST:-0.0.0.0}" +ENV SERVER_PORT="${SERVER_PORT:-8388}" +ENV PASSWORD="${PASSWORD:-secure_password}" +ENV METHOD="${METHOD:-chacha20-ietf-poly1305}" +ENV PLUGIN="${PLUGIN:-/usr/share/shadowsocks-libev/plugins/v2ray-plugin}" +ENV PLUGIN_OPTS="${PLUGIN_OPTS:-server}" +ENV TIMEOUT="${TIMEOUT:-300}" +ENV DNS="${DNS:-8.8.8.8,8.8.4.4}" +ENV TZ=UTC +ENV ARGS= + +COPY entrypoint.sh /usr/local/bin/docker-entrypoint.sh +RUN chmod +x /usr/local/bin/docker-entrypoint.sh +USER nobody +ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] +EXPOSE 8388 +STOPSIGNAL SIGINT +CMD ["/usr/bin/ss-server"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..c346fb8 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# Shadowsock-libev with v2ray-plugin image on Alpine Linux 3.17.0 + +## Build + +Tag is `-` + +```shell +docker build . -t ss-libev-v2ray:3.3.5-r1-1.3.2 +``` + +## Run + +```shell +docker run \ + --detach \ + --name ss-v2ray \ + --env PASSWORD=secure_password \ + --publish 8388:8388 \ + --publish 8388:8388/udp \ + --restart always \ + ss-libev-v2ray:3.3.5-r1-1.3.2 +``` + +Built image is available on DockerHub: + +```shell +docker pull nxhs/ss-libev-v2ray +``` + +See client.json for client config example. Don't forget install v2ray-plugin on client too. diff --git a/client.json b/client.json new file mode 100644 index 0000000..14f0986 --- /dev/null +++ b/client.json @@ -0,0 +1,12 @@ +{ + "server": "your_server_ip_here", + "server_port": 8388, + "local_address": "127.0.0.1", + "local_port": 1080, + "password": "secure_password", + "timeout": 300, + "method": "chacha20-ietf-poly1305", + "fast_open": false, + "plugin":"/usr/share/shadowsocks-libev/plugins/v2ray-plugin", + "workers": 1 +} diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..cc98fd7 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +set -o errexit + +if [ "$1" = "/usr/bin/ss-server" ]; then + if [ -f "$PASSWORD_FILE" ]; then + PASSWORD="$(cat "$PASSWORD_FILE")" + fi + + if [[ -f "/var/run/secrets/$PASSWORD_SECRET" ]]; then + PASSWORD=$(cat "/var/run/secrets/$PASSWORD_SECRET") + fi + + ARGS="-s $SERVER_HOST -p $SERVER_PORT -k ${PASSWORD:-$(hostname)} \ +-m $METHOD -t $TIMEOUT -u $DNS --fast-open --reuse-port --plugin $PLUGIN \ +--plugin-opts $PLUGIN_OPTS $ARGS" +fi + +exec $@ $ARGS