Browse Source

update: docker environment

master
Dnomd343 3 years ago
parent
commit
9c585ab684
  1. 45
      Dockerfile
  2. 10
      docker/compile.py
  3. 3
      docker/init.sh
  4. 0
      docker/test/shadowsocks.py
  5. 0
      docker/test/shadowsocksr.py
  6. 0
      docker/test/sip003.py

45
Dockerfile

@ -73,12 +73,36 @@ cd /tmp/ && tar xf openssl-1.0.2u.tar.gz && cd ./openssl-1.0.2u/ && \
./config --shared --prefix=/usr && make && make install && \
cp /usr/lib/libcrypto.so.1.0.0 /tmp/release/ && \
\
# Install and package numpy / salsa20
pip install numpy salsa20 && \
# Install and package numpy / salsa20 / flask / IPy / redis / pysocks / requests
pip install numpy salsa20 flask IPy redis pysocks && \
mkdir /tmp/packages/ && cd /tmp/packages/ && \
PYTHON_DIR=/usr/lib/`ls /usr/lib/ | grep ^python` && \
cp -r $PYTHON_DIR/site-packages/*numpy* ./ && \
cp -r $PYTHON_DIR/site-packages/*salsa20* ./ && \
PACKAGE_DIR=/usr/lib/`ls /usr/lib/ | grep ^python`/site-packages && \
cp -r $PACKAGE_DIR/*certifi* ./ && \
cp -r $PACKAGE_DIR/*charset* ./ && \
cp -r $PACKAGE_DIR/*click* ./ && \
cp -r $PACKAGE_DIR/*deprecated* ./ && \
cp -r $PACKAGE_DIR/*Deprecated* ./ && \
cp -r $PACKAGE_DIR/*flask* ./ && \
cp -r $PACKAGE_DIR/*Flask* ./ && \
cp -r $PACKAGE_DIR/*idna* ./ && \
cp -r $PACKAGE_DIR/*IPy* ./ && \
cp -r $PACKAGE_DIR/*itsdangerous* ./ && \
cp -r $PACKAGE_DIR/*Jinja2* ./ && \
cp -r $PACKAGE_DIR/*jinja2* ./ && \
cp -r $PACKAGE_DIR/*Jinja2* ./ && \
cp -r $PACKAGE_DIR/*markupsafe* ./ && \
cp -r $PACKAGE_DIR/*MarkupSafe* ./ && \
cp -r $PACKAGE_DIR/*numpy* ./ && \
cp -r $PACKAGE_DIR/*packaging* ./ && \
cp -r $PACKAGE_DIR/*PySocks* ./ && \
cp -r $PACKAGE_DIR/*redis* ./ && \
cp -r $PACKAGE_DIR/*requests* ./ && \
cp -r $PACKAGE_DIR/*salsa20* ./ && \
cp -r $PACKAGE_DIR/*socks* ./ && \
cp -r $PACKAGE_DIR/*urllib3* ./ && \
cp -r $PACKAGE_DIR/*werkzeug* ./ && \
cp -r $PACKAGE_DIR/*Werkzeug* ./ && \
cp -r $PACKAGE_DIR/*wrapt* ./ && \
rm -rf `find ./ -name '__pycache__'` && \
strip `find ./ -name '*.so'` && \
cd ../ && tar czf packages.tar.gz ./packages/ && \
@ -241,14 +265,16 @@ cd /tmp/packages/ && \
tar xf ssr-python.tar.bz2 && rm -f ./ssr-python.tar.bz2 && \
tar xf ss-python.tar.bz2 && rm -f ./ss-python.tar.bz2 && \
tar xf ss-python-legacy.tar.bz2 && rm -f ./ss-python-legacy.tar.bz2 && \
PYTHON_NAME=`ls /usr/lib/ | grep ^python` && \
mkdir -p /tmp/lib/$PYTHON_NAME/ && \
mv /tmp/packages/ /tmp/lib/$PYTHON_NAME/site-packages/
PYTHON_DIR=`ls /usr/lib/ | grep ^python` && \
mkdir -p /tmp/lib/$PYTHON_DIR/ && \
mv /tmp/packages/ /tmp/lib/$PYTHON_DIR/site-packages/
FROM alpine:3.15
COPY . /usr/local/share/ProxyC
COPY --from=asset /tmp/bin/ /usr/bin/
COPY --from=asset /tmp/lib/ /usr/lib/
RUN apk add --no-cache c-ares glib libev libsodium mbedtls pcre python3 udns && \
RUN apk add --no-cache c-ares glib libev libsodium mbedtls pcre python3 redis udns && \
echo "daemonize yes" >> /etc/redis.conf && \
PKG_DIR=/usr/lib/`ls /usr/lib/ | grep ^python`/site-packages && \
rm -rf `find /usr/lib/ -name '__pycache__'` && \
ln -s $PKG_DIR/ssr-python/local.py /usr/bin/ssr-local && \
@ -258,3 +284,4 @@ ln -s $PKG_DIR/ss-python/server.py /usr/bin/ss-python-server && \
ln -s $PKG_DIR/ss-python-legacy/local.py /usr/bin/ss-python-legacy-local && \
ln -s $PKG_DIR/ss-python-legacy/server.py /usr/bin/ss-python-legacy-server && \
ln -s /usr/bin/python3 /usr/bin/python
EXPOSE 43581

10
docker/compile.py

@ -0,0 +1,10 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
import compileall
maxLevels = 256
compileDir = '/usr'
compileall.compile_dir(compileDir, quiet = 1, maxlevels = maxLevels)
compileall.compile_dir(compileDir, quiet = 1, maxlevels = maxLevels, optimize = 1)
compileall.compile_dir(compileDir, quiet = 1, maxlevels = maxLevels, optimize = 2)

3
docker/init.sh

@ -0,0 +1,3 @@
python /usr/local/share/ProxyC/docker/compile.py &
/usr/bin/redis-server /etc/redis.conf
echo "ProxyC is running..."

0
test/docker/shadowsocks.py → docker/test/shadowsocks.py

0
test/docker/shadowsocksr.py → docker/test/shadowsocksr.py

0
test/docker/sip003.py → docker/test/sip003.py

Loading…
Cancel
Save