Skip to content

Commit f59db6f

Browse files
committed
Updating Dockerfile for 9.x using multi-stage build
1 parent 7bc474f commit f59db6f

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

Dockerfile

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1-
FROM debian:10-slim
2-
ARG VERSION=6.2.0
1+
FROM debian:12-slim as build
2+
ARG VERSION=9.0.4
33

4-
RUN apt update
5-
RUN DEBIAN_FRONTEND=noninteractive apt install -y build-essential pkg-config libffi-dev wget git gettext python3
6-
RUN git clone https://github.com/adafruit/circuitpython.git
4+
# Install system requirements
5+
RUN apt update \
6+
&& apt install -y build-essential cmake git git-lfs gettext libffi-dev pkg-config python3 python3-pip python3-venv uncrustify
7+
# Clone the CircuitPython project
8+
RUN git clone -b $VERSION https://github.com/adafruit/circuitpython.git
9+
# Setup build dependencies
710
WORKDIR /circuitpython
8-
RUN git checkout $VERSION
9-
RUN git submodule sync --quiet --recursive
10-
RUN git submodule update --init
11-
RUN make -C mpy-cross
12-
RUN cd ports/unix && make axtls && make micropython && make install
13-
RUN apt-get purge --auto-remove -y build-essential pkg-config libffi-dev wget git gettext python3
14-
RUN rm -rf /circuitpython
15-
WORKDIR /
11+
RUN python3 -m venv .venv
12+
ENV PATH="/circuitpython/.venv/bin:$PATH"
13+
RUN python3 -m pip install --upgrade -r requirements-dev.txt \
14+
&& python tools/ci_fetch_deps.py tests \
15+
# Build the binaires
16+
RUN make -C mpy-cross \
17+
&& make -C ports/unix
18+
19+
# Create final runtime container
20+
FROM debian:12-slim
21+
COPY --from=build /circuitpython/mpy-cross/build/mpy-cross /usr/local/bin/mpy-cross
22+
COPY --from=build /circuitpython/ports/unix/build-standard/micropython /usr/local/bin/micropython
1623
CMD ["/usr/local/bin/micropython"]

0 commit comments

Comments
 (0)