From 38a6d1ec73b7b8406512967156741ba5d9efaf25 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Mon, 23 Oct 2023 12:28:50 -0500 Subject: [PATCH] Add armv6/armv7 docker builds --- Dockerfile | 9 ++-- Dockerfile.armv6 | 105 +++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile.armv7 | 99 ++++++++++++++++++++++++++++++++++++++++++++ Makefile | 10 ++++- 4 files changed, 219 insertions(+), 4 deletions(-) create mode 100644 Dockerfile.armv6 create mode 100644 Dockerfile.armv7 diff --git a/Dockerfile b/Dockerfile index a87d9eb..ea4e15f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,19 @@ FROM quay.io/pypa/manylinux_2_28_x86_64 as build-amd64 +ENV LANG C.UTF-8 + FROM quay.io/pypa/manylinux_2_28_aarch64 as build-arm64 +ENV LANG C.UTF-8 + +# ----------------------------------------------------------------------------- + ARG TARGETARCH ARG TARGETVARIANT FROM build-${TARGETARCH}${TARGETVARIANT} as build ARG TARGETARCH ARG TARGETVARIANT -ENV LANG C.UTF-8 -ENV DEBIAN_FRONTEND=noninteractive - WORKDIR /build COPY ./ ./ diff --git a/Dockerfile.armv6 b/Dockerfile.armv6 new file mode 100644 index 0000000..8ac8483 --- /dev/null +++ b/Dockerfile.armv6 @@ -0,0 +1,105 @@ +# ----------------------------------------------------------------------------- +# Python 3.9 +# ----------------------------------------------------------------------------- + +FROM python:3.9 as python39 +ENV QEMU_CPU=arm1176 +ENV QEMU_MACHINE=versatilepb + +ENV LANG C.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install --yes --no-install-recommends \ + python3-dev build-essential + +# Build +WORKDIR /build +COPY ./ ./ +RUN python3 -m venv venv && \ + venv/bin/pip3 install --upgrade pip && \ + venv/bin/pip3 install --upgrade build wheel auditwheel && \ + venv/bin/python3 -m build --wheel + +# Test +WORKDIR /test +COPY ./tests/ ./tests/ +RUN python3 -m venv venv && \ + venv/bin/pip3 install --upgrade pip && \ + venv/bin/pip3 install --upgrade wheel pytest && \ + venv/bin/pip3 install --no-index webrtc-noise-gain -f /build/dist/ && \ + venv/bin/pytest tests + +# ----------------------------------------------------------------------------- +# Python 3.10 +# ----------------------------------------------------------------------------- + +FROM python:3.10 as python310 +ENV QEMU_CPU=arm1176 +ENV QEMU_MACHINE=versatilepb + +ENV LANG C.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install --yes --no-install-recommends \ + python3-dev build-essential + +# Build +WORKDIR /build +COPY ./ ./ +RUN python3 -m venv venv && \ + venv/bin/pip3 install --upgrade pip && \ + venv/bin/pip3 install --upgrade build wheel auditwheel && \ + venv/bin/python3 -m build --wheel + +# Test +WORKDIR /test +COPY ./tests/ ./tests/ +RUN python3 -m venv venv && \ + venv/bin/pip3 install --upgrade pip && \ + venv/bin/pip3 install --upgrade wheel pytest && \ + venv/bin/pip3 install --no-index webrtc-noise-gain -f /build/dist/ && \ + venv/bin/pytest tests + +# ----------------------------------------------------------------------------- +# Python 3.11 +# ----------------------------------------------------------------------------- + +FROM python:3.11 as python311 +ENV QEMU_CPU=arm1176 +ENV QEMU_MACHINE=versatilepb + +ENV LANG C.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install --yes --no-install-recommends \ + python3-dev build-essential + +# Build +WORKDIR /build +COPY ./ ./ +RUN python3 -m venv venv && \ + venv/bin/pip3 install --upgrade pip && \ + venv/bin/pip3 install --upgrade build wheel auditwheel && \ + venv/bin/python3 -m build --wheel + +# Test +WORKDIR /test +COPY ./tests/ ./tests/ +RUN python3 -m venv venv && \ + venv/bin/pip3 install --upgrade pip && \ + venv/bin/pip3 install --upgrade wheel pytest && \ + venv/bin/pip3 install --no-index webrtc-noise-gain -f /build/dist/ && \ + venv/bin/pytest tests + +# ----------------------------------------------------------------------------- + +FROM scratch +ARG TARGETARCH +ARG TARGETVARIANT + +COPY --from=python39 /build/dist/*.whl ./ +COPY --from=python310 /build/dist/*.whl ./ +COPY --from=python311 /build/dist/*.whl ./ diff --git a/Dockerfile.armv7 b/Dockerfile.armv7 new file mode 100644 index 0000000..8e930b9 --- /dev/null +++ b/Dockerfile.armv7 @@ -0,0 +1,99 @@ +# ----------------------------------------------------------------------------- +# Python 3.9 +# ----------------------------------------------------------------------------- + +FROM python:3.9 as python39 + +ENV LANG C.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install --yes --no-install-recommends \ + python3-dev build-essential + +# Build +WORKDIR /build +COPY ./ ./ +RUN python3 -m venv venv && \ + venv/bin/pip3 install --upgrade pip && \ + venv/bin/pip3 install --upgrade build wheel auditwheel && \ + venv/bin/python3 -m build --wheel + +# Test +WORKDIR /test +COPY ./tests/ ./tests/ +RUN python3 -m venv venv && \ + venv/bin/pip3 install --upgrade pip && \ + venv/bin/pip3 install --upgrade wheel pytest && \ + venv/bin/pip3 install --no-index webrtc-noise-gain -f /build/dist/ && \ + venv/bin/pytest tests + +# ----------------------------------------------------------------------------- +# Python 3.10 +# ----------------------------------------------------------------------------- + +FROM python:3.10 as python310 + +ENV LANG C.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install --yes --no-install-recommends \ + python3-dev build-essential + +# Build +WORKDIR /build +COPY ./ ./ +RUN python3 -m venv venv && \ + venv/bin/pip3 install --upgrade pip && \ + venv/bin/pip3 install --upgrade build wheel auditwheel && \ + venv/bin/python3 -m build --wheel + +# Test +WORKDIR /test +COPY ./tests/ ./tests/ +RUN python3 -m venv venv && \ + venv/bin/pip3 install --upgrade pip && \ + venv/bin/pip3 install --upgrade wheel pytest && \ + venv/bin/pip3 install --no-index webrtc-noise-gain -f /build/dist/ && \ + venv/bin/pytest tests + +# ----------------------------------------------------------------------------- +# Python 3.11 +# ----------------------------------------------------------------------------- + +FROM python:3.11 as python311 + +ENV LANG C.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install --yes --no-install-recommends \ + python3-dev build-essential + +# Build +WORKDIR /build +COPY ./ ./ +RUN python3 -m venv venv && \ + venv/bin/pip3 install --upgrade pip && \ + venv/bin/pip3 install --upgrade build wheel auditwheel && \ + venv/bin/python3 -m build --wheel + +# Test +WORKDIR /test +COPY ./tests/ ./tests/ +RUN python3 -m venv venv && \ + venv/bin/pip3 install --upgrade pip && \ + venv/bin/pip3 install --upgrade wheel pytest && \ + venv/bin/pip3 install --no-index webrtc-noise-gain -f /build/dist/ && \ + venv/bin/pytest tests + +# ----------------------------------------------------------------------------- + +FROM scratch +ARG TARGETARCH +ARG TARGETVARIANT + +COPY --from=python39 /build/dist/*.whl ./ +# COPY --from=python310 /build/dist/*.whl ./ +# COPY --from=python311 /build/dist/*.whl ./ diff --git a/Makefile b/Makefile index f2f7872..f6ba01b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,15 @@ -.PHONY: clean +.PHONY: clean armv6 armv7 all: docker buildx build . --platform linux/amd64,linux/arm64 --output 'type=local,dest=dist' +armv6: + mkdir -p dist/linux_armv6 + docker buildx build . -f Dockerfile.armv6 --platform linux/arm/v6 --output 'type=local,dest=dist/linux_armv6' + +armv7: + mkdir -p dist/linux_armv7 + docker buildx build . -f Dockerfile.armv7 --platform linux/arm/v7 --output 'type=local,dest=dist/linux_armv7' + clean: rm -rf dist