Skip to content

Commit 83a0220

Browse files
committed
Updated docker build
1 parent ac8de69 commit 83a0220

File tree

2 files changed

+42
-16
lines changed

2 files changed

+42
-16
lines changed

build/Dockerfile

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
FROM ekidd/rust-musl-builder
22

3+
#ENV HTTP_PROXY="http://192.168.0.104:8118"
4+
#ENV HTTPS_PROXY="http://192.168.0.104:8118"
5+
6+
ENV SODIUM_VERS="1.0.15"
7+
38
# Build a static copy of libsodium.
4-
RUN VERS=1.0.15 && \
5-
cd /home/rust/libs && \
6-
curl -LO https://download.libsodium.org/libsodium/releases/libsodium-$VERS.tar.gz && \
7-
tar xzf libsodium-$VERS.tar.gz && cd libsodium-$VERS && \
9+
RUN cd /home/rust/libs && \
10+
curl -LO https://download.libsodium.org/libsodium/releases/libsodium-$SODIUM_VERS.tar.gz && \
11+
tar xzf libsodium-$SODIUM_VERS.tar.gz && cd libsodium-$SODIUM_VERS && \
812
CC=musl-gcc ./configure --prefix=/usr/local/musl && \
913
make && sudo make install && \
10-
cd .. && rm -rf libsodium-$VERS.tar.gz libsodium-$VERS
14+
cd .. && rm -rf libsodium-$SODIUM_VERS.tar.gz libsodium-$SODIUM_VERS
15+
16+
#RUN rustup install nightly
17+
#RUN rustup default nightly
18+
#RUN rustup target add x86_64-unknown-linux-musl
1119

1220
ENV SODIUM_STATIC=yes
1321
ENV SODIUM_LIB_DIR=/usr/local/musl/lib

build/build-release

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
#!/bin/sh
22

3+
VERSION="latest"
4+
ENABLE_GZ=false
5+
6+
while getopts "v:gh" opt; do
7+
case $opt in
8+
v)
9+
VERSION=$OPTARG
10+
;;
11+
g)
12+
ENABLE_GZ=true
13+
;;
14+
h|\?)
15+
echo "$0 [-v VERSION] [-g] [-h]"
16+
exit 0
17+
;;
18+
esac
19+
done
20+
321
IMAGE='shadowsocks-rust:latest'
422
CUR_DIR=$( cd $( dirname $0 ) && pwd )
523

@@ -9,6 +27,8 @@ SRC_PATH="/home/rust/src"
927
CARGO_TARGET_DIR="${SRC_PATH}/build/target"
1028
LOCAL_USER=$( id -u "$USER" ):$( id -g "$USER" )
1129

30+
TARGET_NAME="x86_64-unknown-linux-musl"
31+
1232
docker run \
1333
-e CARGO_TARGET_DIR="${CARGO_TARGET_DIR}" \
1434
-v "${CUR_DIR}"/..:"$SRC_PATH" \
@@ -17,25 +37,23 @@ docker run \
1737
/bin/bash -c \
1838
"sudo mkdir -p $CARGO_TARGET_DIR \
1939
&& sudo chown -R rust:rust $CARGO_TARGET_DIR \
20-
&& cargo build --release \
40+
&& cargo build --release --target $TARGET_NAME \
2141
&& sudo chown -R $LOCAL_USER $CARGO_TARGET_DIR"
2242

23-
TARGET_NAME="x86_64-unknown-linux-musl"
43+
2444
TARGET_DIR="$CUR_DIR/target/$TARGET_NAME/release/"
2545
cd "$TARGET_DIR"
2646

27-
VERSION=$1
28-
if [[ -z "$VERSION" ]]; then
29-
VERSION="latest"
30-
fi
31-
3247
## Disable OS X ACL file
3348
export COPYFILE_DISABLE=1
3449

35-
tar -czf "${CUR_DIR}/shadowsocks-${VERSION}-release.${TARGET_NAME}.tar.gz" \
36-
"sslocal" \
37-
"ssserver" \
38-
"ssurl"
50+
if $ENABLE_GZ; then
51+
tar -czf "${CUR_DIR}/shadowsocks-${VERSION}-release.${TARGET_NAME}.tar.gz" \
52+
"sslocal" \
53+
"ssserver" \
54+
"ssurl"
55+
fi
56+
3957
tar -cJf "${CUR_DIR}/shadowsocks-${VERSION}-release.${TARGET_NAME}.tar.xz" \
4058
"sslocal" \
4159
"ssserver" \

0 commit comments

Comments
 (0)