-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add build-and-run.sh script for Docker image building and testing
- Loading branch information
1 parent
f807989
commit 8f1a581
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
#? Description: | ||
#? Build the Docker image and run the container for testing. | ||
#? | ||
#? Usage: | ||
#? build-and-run.sh | ||
#? | ||
#? Options: | ||
#? None | ||
#? | ||
#? Environment: | ||
#? The following environment variables are used by this script: | ||
#? | ||
#? - XSH_AWS_CFN_VPN_DOMAIN | ||
#? | ||
#? Required, default is unset. | ||
#? The domain name for the V2Ray service. | ||
#? | ||
#? - Namecom_Username | ||
#? | ||
#? Required, default is unset. | ||
#? The username for the Name.com API. | ||
#? | ||
#? - Namecom_Token | ||
#? | ||
#? Required, default is unset. | ||
#? The token for the Name.com API. | ||
#? | ||
|
||
set -e -o pipefail | ||
|
||
declare tag | ||
tag=dev-$(date +%Y%m%d-%H%M%S) | ||
docker build -t "alexzhangs/shadowsocks-libev-v2ray:$tag" . | ||
|
||
declare MGR_PORT=6001 SS_PORTS=8381-8385 ENCRYPT=aes-256-cfb DOMAIN=$XSH_AWS_CFN_VPN_DOMAIN | ||
declare DNS=dns_namecom DNS_ENV="Namecom_Username=$Namecom_Username,Namecom_Token=$Namecom_Token" | ||
|
||
docker run -e V2RAY=1 -e DOMAIN="$DOMAIN" \ | ||
-e DNS="$DNS" -e DNS_ENV="$DNS_ENV" \ | ||
--restart=always -d -p $MGR_PORT:$MGR_PORT/UDP -p $SS_PORTS:$SS_PORTS -p $SS_PORTS:$SS_PORTS/UDP\ | ||
--name "ss-manager-v2ray-$tag" "alexzhangs/shadowsocks-libev-v2ray:$tag" \ | ||
ss-manager --manager-address 0.0.0.0:$MGR_PORT \ | ||
--executable /usr/local/bin/ss-server -m "$ENCRYPT" -s 0.0.0.0 -u \ | ||
--plugin v2ray-plugin --plugin-opts "server;tls;host=$DOMAIN" |