Support for target variant (needed for armv6)
This commit is contained in:
+14
-6
@@ -9,24 +9,32 @@ ARG TARGETS
|
|||||||
ENV DIR=/go/src/github.com/Psiphon-Labs/psiphon-tunnel-core \
|
ENV DIR=/go/src/github.com/Psiphon-Labs/psiphon-tunnel-core \
|
||||||
GO111MODULE=off \
|
GO111MODULE=off \
|
||||||
CGO_ENABLED=0
|
CGO_ENABLED=0
|
||||||
|
SHELL ["/bin/bash", "-c"]
|
||||||
RUN TARGET_PALTFORMS=${TARGETS:-"$BUILDOS/$BUILDARCH"}; \
|
RUN TARGET_PALTFORMS=${TARGETS:-"$BUILDOS/$BUILDARCH"}; \
|
||||||
mkdir -p ${DIR} && \
|
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 && \
|
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; \
|
(IFS=','; for PLATFORM in $TARGET_PALTFORMS; \
|
||||||
do \
|
do \
|
||||||
OS=${PLATFORM%%/*} && \
|
OS=${PLATFORM%%/*} && \
|
||||||
ARCH=${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=${ARCH%/*} && \
|
||||||
BINARY=$(find /go/bin/* -name "ConsoleClient*") && \
|
VERSION=${PLATFORM##*/} && \
|
||||||
mv ${BINARY} /go/psiphon_${OS}_${ARCH}; \
|
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}_${TARGETVARIANT}; \
|
||||||
done)
|
done)
|
||||||
|
|
||||||
FROM alpine:3.16.0
|
FROM alpine:3.16.0
|
||||||
RUN mkdir -p /psiphon /config
|
RUN mkdir -p /psiphon /config
|
||||||
ARG TARGETOS
|
ARG TARGETOS
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
ARG TARGETVARIANT
|
||||||
COPY start_psiphon psiphon.config /psiphon/
|
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
|
EXPOSE 8080 1080
|
||||||
VOLUME /config
|
VOLUME /config
|
||||||
CMD ["/bin/sh", "/psiphon/start_psiphon"]
|
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
|
3. Build docker image for current platform or multi-arch
|
||||||
```bash
|
```bash
|
||||||
# choose target platforms
|
# 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
|
# Create a builder instance
|
||||||
sudo docker buildx create --name cross-platform --platform ${TARGETS} --use
|
sudo docker buildx create --name cross-platform --platform ${TARGETS} --use
|
||||||
|
|||||||
Reference in New Issue
Block a user