1+ FROM python:3.13-bookworm AS base
2+
3+ ENV PIP_ROOT_USER_ACTION=ignore
4+ ENV ARM_TOOLCHAIN_EABI_VERSION=14.2.rel1
5+ ENV ARM_TOOLCHAIN_ELF_VERSION=13.3.rel1
6+
7+ # Apt dependencies
8+ RUN apt-get update && apt-get install -y \
9+ jq jdupes build-essential \
10+ libgpiod-dev libyaml-cpp-dev libbluetooth-dev libusb-1.0-0-dev libi2c-dev libuv1-dev \
11+ libx11-dev libinput-dev libxkbcommon-x11-dev \
12+ openssl libssl-dev libulfius-dev liborcania-dev \
13+ git git-lfs gettext cmake mtools floppyd dosfstools \
14+ && rm -rf /var/lib/apt/lists/*
15+
16+ # Install ARM toolchain (EABI) based on architecture
17+ RUN ARCH=$(dpkg --print-architecture) && \
18+ if [ "$ARCH" = "arm64" ]; then \
19+ TOOLCHAIN_URL="https://developer.arm.com/-/media/Files/downloads/gnu/$ARM_TOOLCHAIN_EABI_VERSION/binrel/arm-gnu-toolchain-$ARM_TOOLCHAIN_EABI_VERSION-aarch64-arm-none-eabi.tar.xz" ; \
20+ elif [ "$ARCH" = "amd64" ]; then \
21+ TOOLCHAIN_URL="https://developer.arm.com/-/media/Files/downloads/gnu/$ARM_TOOLCHAIN_EABI_VERSION/binrel/arm-gnu-toolchain-$ARM_TOOLCHAIN_EABI_VERSION-x86_64-arm-none-eabi.tar.xz" ; \
22+ else \
23+ echo "Unsupported architecture: $ARCH" ; \
24+ exit 1; \
25+ fi && \
26+ mkdir -p /usr/local/arm-none-eabi && \
27+ curl -fsSL "$TOOLCHAIN_URL" | tar -xJ -C /usr/local/arm-none-eabi --strip-components=1 && \
28+ for f in /usr/local/arm-none-eabi/bin/arm-none-eabi-*; do \
29+ ln -sf "$f" /usr/local/bin/$(basename "$f" ); \
30+ done
31+
32+ # Install ARM toolchain (ELF) based on architecture
33+ RUN ARCH=$(dpkg --print-architecture) && \
34+ if [ "$ARCH" = "arm64" ]; then \
35+ TOOLCHAIN_URL="https://developer.arm.com/-/media/Files/downloads/gnu/$ARM_TOOLCHAIN_ELF_VERSION/binrel/arm-gnu-toolchain-$ARM_TOOLCHAIN_ELF_VERSION-aarch64-aarch64-none-elf.tar.xz" ; \
36+ elif [ "$ARCH" = "amd64" ]; then \
37+ TOOLCHAIN_URL="https://developer.arm.com/-/media/Files/downloads/gnu/$ARM_TOOLCHAIN_ELF_VERSION/binrel/arm-gnu-toolchain-$ARM_TOOLCHAIN_ELF_VERSION-x86_64-aarch64-none-elf.tar.xz" ; \
38+ else \
39+ echo "Unsupported architecture: $ARCH" ; \
40+ exit 1; \
41+ fi && \
42+ mkdir -p /usr/local/arm-none-elf && \
43+ curl -fsSL "$TOOLCHAIN_URL" | tar -xJ -C /usr/local/arm-none-elf --strip-components=1 && \
44+ for f in /usr/local/arm-none-elf/bin/arm-none-elf-*; do \
45+ ln -sf "$f" /usr/local/bin/$(basename "$f" ); \
46+ done
47+
48+ FROM base AS repo
49+ ARG BUILD_REPO="https://github.com/adafruit/circuitpython.git"
50+ ARG BUILD_REF="main"
51+ ARG BUILD_FORK_REPO="https://github.com/fobe-projects/circuitpython.git"
52+ ARG BUILD_FORK_REF="main"
53+ ARG BUILD_PLATFORM
54+
55+ WORKDIR /workspace
56+
57+ RUN git config --global --add safe.directory /workspace
58+ RUN git clone --depth 1 --filter=tree:0 "${BUILD_REPO}" /workspace
59+ RUN git checkout "${BUILD_REF}"
60+ RUN git fetch --no-recurse-submodules --shallow-since="2021-07-01" --tags "${BUILD_REPO}" HEAD
61+ RUN git fetch --no-recurse-submodules --shallow-since="2021-07-01" origin
62+ RUN git repack -d
63+ RUN git remote add fork "${BUILD_FORK_REPO}" && git fetch fork --filter=tree:0
64+ RUN git checkout -b fork-branch "fork/${BUILD_FORK_REF}"
65+
66+ RUN pip3 install --upgrade -r requirements-dev.txt && pip3 install --upgrade -r requirements-doc.txt
67+ RUN pip3 install --upgrade huffman
68+
69+ RUN python tools/ci_fetch_deps.py ${BUILD_PLATFORM}
70+
71+ COPY entrypoint.sh /entrypoint.sh
72+ ENTRYPOINT [ "/entrypoint.sh" ]
0 commit comments