Skip to content

Commit

Permalink
Add armv6/armv7 docker builds
Browse files Browse the repository at this point in the history
  • Loading branch information
synesthesiam committed Oct 23, 2023
1 parent 0b3bc23 commit 38a6d1e
Show file tree
Hide file tree
Showing 4 changed files with 219 additions and 4 deletions.
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 ./ ./
Expand Down
105 changes: 105 additions & 0 deletions Dockerfile.armv6
Original file line number Diff line number Diff line change
@@ -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 ./
99 changes: 99 additions & 0 deletions Dockerfile.armv7
Original file line number Diff line number Diff line change
@@ -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 ./
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 38a6d1e

Please sign in to comment.