run: |
sudo apt-get update
sudo apt-get install -y autoconf automake build-essential cmake curl file libtool
- - name: Cross build amd64/arm64 binary
+ - name: Cross build multi-arch binary
run: |
- for arch in amd64 arm64; do
+ mkdir dist
+ for arch in amd64 armv7 arm64 s390x; do
env BUILD_TARGET=$arch ./scripts/cross-build.sh
- cp build/ttyd ttyd.$arch
+ [ "$arch" = "armv7" ] && arch="arm"
+ mkdir -p dist/$arch && cp build/ttyd dist/$arch/ttyd
done
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
with:
context: .
file: ./Dockerfile
- platforms: linux/amd64,linux/arm64
+ platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/s390x
push: true
tags: ${{ steps.docker_tag.outputs.DOCKER_TAG }}
- name: build/push docker image (alpine)
with:
context: .
file: ./Dockerfile.alpine
- platforms: linux/amd64,linux/arm64
+ platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/s390x
push: true
tags: ${{ steps.docker_tag.outputs.ALPINE_TAG }}
FROM ubuntu:20.04
ARG TARGETARCH
-COPY ./ttyd.${TARGETARCH} /usr/bin/ttyd
+COPY ./dist/${TARGETARCH}/ttyd /usr/bin/ttyd
RUN apt-get update && apt-get install -y --no-install-recommends tini && rm -rf /var/lib/apt/lists/*
EXPOSE 7681
build_ttyd
}
-[ "${BUILD_TARGET}" = "amd64" ] && BUILD_TARGET="x86_64"
-[ "${BUILD_TARGET}" = "arm64" ] && BUILD_TARGET="aarch64"
+case ${BUILD_TARGET} in
+ amd64) BUILD_TARGET="x86_64" ;;
+ arm64) BUILD_TARGET="aarch64" ;;
+ armv7) BUILD_TARGET="armv7l" ;;
+esac
case ${BUILD_TARGET} in
- i686|x86_64|aarch64|mips|mipsel|mips64|mips64el)
+ i686|x86_64|aarch64|mips|mipsel|mips64|mips64el|s390x)
build "${BUILD_TARGET}-linux-musl" "${BUILD_TARGET}"
;;
arm)
- build arm-linux-musleabi "${BUILD_TARGET}"
+ build "${BUILD_TARGET}-linux-musleabi" "${BUILD_TARGET}"
;;
armhf)
build arm-linux-musleabihf "${BUILD_TARGET}"
;;
+ armv7l)
+ build armv7l-linux-musleabihf "${BUILD_TARGET}"
+ ;;
*)
echo "unknown cross target: ${BUILD_TARGET}" && exit 1
esac