mirror of
https://github.com/tsl0922/ttyd.git
synced 2026-02-06 18:14:24 +01:00
workflow: build docker image for armv7 and s390x
This commit is contained in:
12
.github/workflows/docker.yml
vendored
12
.github/workflows/docker.yml
vendored
@@ -14,11 +14,13 @@ jobs:
|
||||
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
|
||||
@@ -44,7 +46,7 @@ jobs:
|
||||
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)
|
||||
@@ -52,6 +54,6 @@ jobs:
|
||||
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 }}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
FROM alpine
|
||||
|
||||
ARG TARGETARCH
|
||||
COPY ./ttyd.${TARGETARCH} /usr/bin/ttyd
|
||||
COPY ./dist/${TARGETARCH}/ttyd /usr/bin/ttyd
|
||||
RUN apk add --no-cache bash tini
|
||||
|
||||
EXPOSE 7681
|
||||
|
||||
@@ -153,19 +153,25 @@ build() {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user