Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9593aac622 | ||
|
|
df2d2fe36f | ||
|
|
8bd953079c | ||
|
|
4266d9124d |
+1
-1
@@ -17,7 +17,7 @@ fi
|
||||
/go/build.sh ${ARGS}
|
||||
__SCRIPT__
|
||||
|
||||
FROM alpine:3.22.1
|
||||
FROM alpine:3.22.2
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
ARG TARGETVARIANT
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
Docker image for Psiphon
|
||||
|
||||
Psiphon is an Internet censorship circumvention system. <br>
|
||||
This docker image runs the ConsoleClient from the [psiphon-tunnel-core](https://github.com/Psiphon-Labs/psiphon-tunnel-core "psiphon-tunnel-core").
|
||||
This Docker image runs the ConsoleClient from the [psiphon-tunnel-core](https://github.com/Psiphon-Labs/psiphon-tunnel-core "psiphon-tunnel-core").
|
||||
|
||||
> This build uses `docker buildx` plugin with `docker-container` driver. <br>
|
||||
> This build uses the `docker buildx` plugin with the `docker-container` driver. <br>
|
||||
> Docker image available at [swarupsengupta2007/psiphon](https://hub.docker.com/r/swarupsengupta2007/psiphon "swarupsengupta2007/psiphon"). <br>
|
||||
|
||||
```bash
|
||||
@@ -15,9 +15,9 @@ git clone https://github.com/swarupsengupta2007/psiphon-docker
|
||||
|
||||
# Building<br>
|
||||
|
||||
1. Ensure buildx is enabled for docker
|
||||
1. Ensure buildx is enabled for Docker
|
||||
2. Create a builder instance for multi-arch
|
||||
3. Build docker image for current platform or multi-arch
|
||||
3. Build Docker image for current platform or multi-arch
|
||||
```bash
|
||||
# choose target platforms
|
||||
TARGETS="linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6"
|
||||
@@ -25,13 +25,13 @@ TARGETS="linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6"
|
||||
# Create a builder instance if it doesn't exist
|
||||
docker buildx create --name cross-platform --platform ${TARGETS} --use
|
||||
|
||||
# Build for current platform and load to docker image
|
||||
# Build for the current platform and load to Docker image
|
||||
docker buildx build -t <your_tag> . --load
|
||||
|
||||
# If not already done, install the required cross-platform emulators
|
||||
docker run --privileged --rm tonistiigi/binfmt --install all
|
||||
|
||||
# run the script, this will build the image for current platform and load it to docker
|
||||
# run the script, this will build the image for the current platform and load it to Docker
|
||||
./make.bash --load
|
||||
```
|
||||
|
||||
@@ -82,21 +82,21 @@ docker run -d \
|
||||
swarupsengupta2007/psiphon
|
||||
```
|
||||
|
||||
The following Environment var are available (only applicable when running for the first tome with no psiphon.config in the mounted config directory)<br>
|
||||
The following Environment var are available (only applicable when running for the first time with no psiphon.config in the mounted config directory)<br>
|
||||
|ENV variable|Description|Default|
|
||||
|--|--|--|
|
||||
|PUID|The UID for psiphon process|1000|
|
||||
|PGID|The GID for psiphon process|1000|
|
||||
|HTTP_PORT|The HTTP proxy port|8080|
|
||||
|SOCKS_PORT|The SOCKS proxy port|1080|
|
||||
|DEVICE_REGION|The device region for psiphon client|IN|
|
||||
|EGRESS_REGION|The egress region for psiphon client|SG|
|
||||
|DEVICE_REGION|The device region for Psiphon client|IN|
|
||||
|EGRESS_REGION|The egress region for Psiphon client|SG|
|
||||
|
||||
# Configuration
|
||||
The psiphon client configuration is stored in the mounted config directory. /config must be mounted and writable by the psiphon process. <br>
|
||||
The Psiphon client configuration is stored in the mounted config directory. /config must be mounted and writable by the psiphon process. <br>
|
||||
|
||||
# Healthcheck
|
||||
The container has a healthcheck script that checks if the psiphon client is running and healthy. <br>
|
||||
The container has a healthcheck script that checks if the Psiphon client is running and healthy. <br>
|
||||
You can check the health status of the container using the following command:
|
||||
```bash
|
||||
docker inspect --format='{{json .State.Health}}' psiphon
|
||||
|
||||
@@ -61,7 +61,8 @@ CURRENT_TARGET="$(go env GOOS)/$(go env GOARCH)"
|
||||
TARGETS=${TARGETS:-"current"}
|
||||
|
||||
TARGETS=$(decipher_targets "${TARGETS}")
|
||||
TARGETS=${TARGETS//,/ }
|
||||
TARGETS=${TARGETS%$'\n'}
|
||||
IFS=' ' TARGETS=(${TARGETS//,/ })
|
||||
|
||||
BUILD_DIR=$(pwd)/tmp_build_$$
|
||||
rm -rf "${BUILD_DIR}"
|
||||
@@ -77,21 +78,21 @@ pushd "${BUILD_DIR}/ConsoleClient" > /dev/null
|
||||
|
||||
export CGO_ENABLED=0
|
||||
|
||||
for PLATFORM in ${TARGETS}
|
||||
for PLATFORM in "${TARGETS[@]}"
|
||||
do
|
||||
IFS='/' read -r OS ARCH VARIANT <<< "${PLATFORM}"
|
||||
|
||||
export GOOS=${OS}
|
||||
export GOARCH=${ARCH}
|
||||
if [[ -n "${VARIANT}" ]]; then
|
||||
export GOARM=${VARIANT#v}
|
||||
fi
|
||||
GOEXT=""
|
||||
if [[ "${OS}" == "windows" ]]; then
|
||||
GOEXT=".exe"
|
||||
fi
|
||||
${GO} build -a -tags netgo -ldflags "-s -w -extldflags '-static'" -o "${BIN_DIR}/psiphon_${PLATFORM//\//_}${GOEXT}"
|
||||
unset GOOS GOARCH GOARM
|
||||
echo "Building for ${PLATFORM}..."
|
||||
IFS='/' read -r OS ARCH VARIANT <<< "${PLATFORM}"
|
||||
export GOOS=${OS}
|
||||
export GOARCH=${ARCH}
|
||||
if [[ -n "${VARIANT}" ]]; then
|
||||
export GOARM=${VARIANT#v}
|
||||
fi
|
||||
GOEXT=""
|
||||
if [[ "${OS}" == "windows" ]]; then
|
||||
GOEXT=".exe"
|
||||
fi
|
||||
${GO} build -a -tags netgo -ldflags "-s -w -extldflags '-static'" -o "${BIN_DIR}/psiphon_${PLATFORM//\//_}${GOEXT}"
|
||||
unset GOOS GOARCH GOARM
|
||||
done
|
||||
|
||||
popd > /dev/null
|
||||
|
||||
@@ -7,10 +7,13 @@ function help_message() {
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo "Options:"
|
||||
echo " --targets, -t <targets> Comma-separated list of target platforms (default: current, use 'all' for all supported targets)"
|
||||
echo " --version, -v <version> Psiphon version to build (default: 2.0.32)"
|
||||
echo " --version, -v <version> Psiphon version to build (default: latest available)"
|
||||
echo " --go, -g <version> Go version to use (default: 1.22.7)"
|
||||
echo " --help, -h Show this help message and exit"
|
||||
echo " --load Load the built image into local Docker (cannot be used with --push)"
|
||||
echo " --push Push the built image to Docker Hub (cannot be used with --load)"
|
||||
echo " --supported-targets Show supported targets and exit"
|
||||
echo " --current-target Show current target platform and exit"
|
||||
echo " --help, -h Show this help message and exit"
|
||||
exit ${1:-1}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user