Support for target variant (needed for armv6)
This commit is contained in:
+12
-4
@@ -9,24 +9,32 @@ ARG TARGETS
|
||||
ENV DIR=/go/src/github.com/Psiphon-Labs/psiphon-tunnel-core \
|
||||
GO111MODULE=off \
|
||||
CGO_ENABLED=0
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
RUN TARGET_PALTFORMS=${TARGETS:-"$BUILDOS/$BUILDARCH"}; \
|
||||
mkdir -p ${DIR} && \
|
||||
curl -sL https://github.com/Psiphon-Labs/psiphon-tunnel-core/archive/refs/tags/v${VERSION}.tar.gz | tar xz -C ${DIR} --strip-components=1 && \
|
||||
(IFS=','; for PLATFORM in $TARGET_PALTFORMS; \
|
||||
do \
|
||||
OS=${PLATFORM%%/*} && \
|
||||
ARCH=${PLATFORM##*/} && \
|
||||
GOOS=${OS} GOARCH=${ARCH} go install -a -tags netgo -ldflags '-w -extldflags "-static"' github.com/Psiphon-Labs/psiphon-tunnel-core/ConsoleClient && \
|
||||
ARCH=${PLATFORM#*/} && \
|
||||
ARCH=${ARCH%/*} && \
|
||||
VERSION=${PLATFORM##*/} && \
|
||||
TARGETVARIANT=${VERSION/$ARCH/} && \
|
||||
VERSION=${TARGETVER/v/} && \
|
||||
GOOS=${OS} GOARCH=${ARCH} go install -a -tags netgo \
|
||||
-ldflags '-w -extldflags "-static"' \
|
||||
github.com/Psiphon-Labs/psiphon-tunnel-core/ConsoleClient && \
|
||||
BINARY=$(find /go/bin/* -name "ConsoleClient*") && \
|
||||
mv ${BINARY} /go/psiphon_${OS}_${ARCH}; \
|
||||
mv ${BINARY} /go/psiphon_${OS}_${ARCH}_${TARGETVARIANT}; \
|
||||
done)
|
||||
|
||||
FROM alpine:3.16.0
|
||||
RUN mkdir -p /psiphon /config
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
ARG TARGETVARIANT
|
||||
COPY start_psiphon psiphon.config /psiphon/
|
||||
COPY --from=psiphon_builder /go/psiphon_${TARGETOS}_${TARGETARCH} /psiphon/psiphon
|
||||
COPY --from=psiphon_builder /go/psiphon_${TARGETOS}_${TARGETARCH}_${TARGETVARIANT} /psiphon/psiphon
|
||||
EXPOSE 8080 1080
|
||||
VOLUME /config
|
||||
CMD ["/bin/sh", "/psiphon/start_psiphon"]
|
||||
|
||||
@@ -19,7 +19,7 @@ git clone https://github.com/swarupsengupta2007/psiphon-docker
|
||||
3. Build docker image for current platform or multi-arch
|
||||
```bash
|
||||
# choose target platforms
|
||||
TARGETS="linux/amd64,linux/386,linux/arm64,linux/arm"
|
||||
TARGETS="linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6"
|
||||
|
||||
# Create a builder instance
|
||||
sudo docker buildx create --name cross-platform --platform ${TARGETS} --use
|
||||
|
||||
Reference in New Issue
Block a user