Browse Source

add Dockerfile based on alpine

pull/528/head
kev 9 years ago
parent
commit
958d856117
6 changed files with 136 additions and 0 deletions
  1. 40
      docker/alpine/Dockerfile
  2. 88
      docker/alpine/README.md
  3. 8
      docker/alpine/docker-compose.yml
  4. 0
      docker/ubuntu/Dockerfile
  5. 0
      docker/ubuntu/README.md
  6. 0
      docker/ubuntu/entrypoint

40
docker/alpine/Dockerfile

@ -0,0 +1,40 @@
#
# Dockerfile for shadowsocks-libev
#
FROM alpine
MAINTAINER kev <noreply@datageek.info>
ENV SS_VER 2.4.4
ENV SS_URL https://github.com/shadowsocks/shadowsocks-libev/archive/v$SS_VER.tar.gz
ENV SS_DIR shadowsocks-libev-$SS_VER
ENV SS_DEP autoconf build-base curl libtool linux-headers openssl-dev
RUN set -ex \
&& apk add --update $SS_DEP \
&& curl -sSL $SS_URL | tar xz \
&& cd $SS_DIR \
&& ./configure \
&& make install \
&& cd .. \
&& rm -rf $SS_DIR \
&& apk del --purge $SS_DEP \
&& rm -rf /var/cache/apk/*
ENV SERVER_ADDR 0.0.0.0
ENV SERVER_PORT 8388
ENV PASSWORD=
ENV METHOD aes-256-cfb
ENV TIMEOUT 300
ENV DNS_ADDR 8.8.8.8
EXPOSE $SERVER_PORT
CMD ss-server -s $SERVER_ADDR \
-p $SERVER_PORT \
-k ${PASSWORD:-$(hostname)} \
-m $METHOD \
-t $TIMEOUT \
--fast-open \
-d $DNS_ADDR \
-u

88
docker/alpine/README.md

@ -0,0 +1,88 @@
shadowsocks-libev
=================
[shadowsocks-libev][1] is a lightweight secured socks5 proxy for embedded
devices and low end boxes. It is a port of [shadowsocks][2] created by
@clowwindy maintained by @madeye and @linusyang.
Suppose we have a VPS running Debian or Ubuntu.
To deploy the service quickly, we can use [docker][3].
## Install docker
```
$ curl -sSL https://get.docker.com/ | sh
$ docker --version
```
## Build docker image
```bash
$ curl -sSL https://github.com/shadowsocks/shadowsocks-libev/blob/master/docker/alpine/Dockerfile | docker build -t shadowsocks-libev .
$ docker images
```
> You can also use a pre-built docker image: [vimagick/shadowsocks-libev][4] ![][5].
## Run docker container
```bash
$ docker run -d -e METHOD=aes-256-cfb -e PASSWORD=9MLSpPmNt -p 8388:8388 --restart always shadowsocks-libev
$ docker ps
```
> :warning: Click [here][6] to generate a strong password to protect your server.
## Use docker-compose to manage (optional)
It is very handy to use [docker-compose][7] to manage docker containers.
You can download the binary at <https://github.com/docker/compose/releases>.
This is a sample `docker-compose.yml` file.
```yaml
shadowsocks:
image: shadowsocks-libev
ports:
- "8388:8388"
environment:
- METHOD=aes-256-cfb
- PASSWORD=9MLSpPmNt
restart: always
```
It is highly recommended that you setup a directory tree to make things easy to manage.
```bash
$ mkdir -p ~/fig/shadowsocks/
$ cd ~/fig/shadowsocks/
$ curl -sSLO https://github.com/shadowsocks/shadowsocks-libev/blob/master/docker/alpine/docker-compose.yml
$ docker-compose up -d
$ docker-compose ps
```
## Finish
At last, download shadowsocks client [here][8].
Don't forget to share internet with your friends.
```yaml
{
"server": "your-vps-ip",
"server_port": 8388,
"local_address": "0.0.0.0",
"local_port": 1080,
"password": "9MLSpPmNt",
"timeout": 600,
"method": "aes-256-cfb"
}
```
[1]: https://github.com/shadowsocks/shadowsocks-libev
[2]: https://shadowsocks.org/en/index.html
[3]: https://github.com/docker/docker
[4]: https://hub.docker.com/r/vimagick/shadowsocks-libev/
[5]: https://badge.imagelayers.io/vimagick/shadowsocks-libev:latest.svg
[6]: https://duckduckgo.com/?q=password+12&t=ffsb&ia=answer
[7]: https://github.com/docker/compose
[8]: https://shadowsocks.org/en/download/clients.html

8
docker/alpine/docker-compose.yml

@ -0,0 +1,8 @@
shadowsocks:
image: shadowsocks-libev
ports:
- "8388:8388"
environment:
- METHOD=aes-256-cfb
- PASSWORD=9MLSpPmNt
restart: always

docker/Dockerfile → docker/ubuntu/Dockerfile

docker/README.md → docker/ubuntu/README.md

docker/entrypoint → docker/ubuntu/entrypoint

Loading…
Cancel
Save