Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@ jobs:
python3 runtest.py 0_demo.ipynb 2.1_first_module.ipynb 2.6_chiselsim.ipynb 4.1_firrtl_ast.ipynb
docker run --rm --network none chisel-bootcamp:test python3 tests/test_visualizer.py

- name: Build and push
if: github.event_name == 'push'
# Build every platform on pull requests too, so a platform-specific break (such as a
# package missing for Arm64) fails before merge; only a push to dev publishes.
- name: Build all platforms (push only on push)
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
push: ${{ github.event_name == 'push' }}
tags: sysprog21/chisel-bootcamp:latest
cache-from: type=gha,scope=build
cache-to: type=gha,mode=max,scope=build
24 changes: 13 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
# First stage : setup the system and environment
FROM alpine:3.22 AS base

ARG TARGETARCH

# Install OpenJDK 17 and runtime dependencies.
# Chisel 7 simulates with ChiselSim, which drives Verilator, so a C++ toolchain
# (g++, make, musl-dev) and Perl (Verilator is a Perl script) are runtime dependencies.
# Stable Alpine ships Verilator for x86-64 only, so both architectures take it from the
# edge/community repository; the @edge tag keeps every other package on 3.22. Later apk
# calls need --no-cache (or a fresh index) so that the @edge tag still resolves.
# On Arm64, firtool (an x86-64 executable, see the intermediate-builder stage) runs
# through qemu-user.
RUN \
echo "@edge https://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
apk add --no-cache \
openjdk17-jre-headless \
graphviz \
python3 \
py3-pip \
bash \
libstdc++ \
verilator \
verilator-dev \
verilator@edge \
verilator-dev@edge \
Comment thread
jserv marked this conversation as resolved.
Resolved
g++ \
make \
musl-dev \
perl \
&& \
if [ "$TARGETARCH" = "arm64" ]; then apk add --no-cache qemu-x86_64; fi && \
apk add --no-cache --virtual .build-deps \
gcc \
linux-headers \
Expand All @@ -32,7 +41,7 @@ RUN \
find /usr/lib/python3.12/site-packages -type d -name tests -exec rm -rf {} + 2>/dev/null || true && \
find /usr/lib/python3.12/site-packages -type d -name testing -exec rm -rf {} + 2>/dev/null || true && \
rm -rf /usr/lib/python3.12/site-packages/pip /usr/lib/python3.12/site-packages/setuptools && \
apk del .build-deps
apk del --no-cache .build-deps

ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk
ENV PATH=$JAVA_HOME/bin:$PATH
Expand Down Expand Up @@ -98,7 +107,7 @@ RUN \
# Chisel 7 emits SystemVerilog by running CIRCT's `firtool`, a self-contained static x86-64
# executable (Maven Central ships it inside the llvm-firtool jar). Install it once here so
# the bootcamp works offline. There is no native Linux/Arm64 build of firtool: on Arm64 it
# runs through qemu-user (the rest of the toolchain, including Verilator, is native).
# runs through qemu-user, installed in the base stage (the rest of the toolchain is native).
RUN \
mkdir -p /opt/firtool/bin && \
curl -fL --retry 3 -o firtool.jar \
Expand All @@ -107,7 +116,6 @@ RUN \
rm firtool.jar && \
chmod +x /opt/firtool/bin/firtool.x86_64 && \
if [ "$TARGETARCH" = "arm64" ]; then \
apk add --no-cache qemu-x86_64 && \
printf '#!/bin/sh\nexec qemu-x86_64 /opt/firtool/bin/firtool.x86_64 "$@"\n' > /opt/firtool/bin/firtool && \
chmod +x /opt/firtool/bin/firtool; \
else \
Expand All @@ -117,12 +125,6 @@ RUN \
# Last stage
FROM base AS final

ARG TARGETARCH

# On Arm64 firtool (an x86-64 executable) runs through qemu-user, see above
RUN if [ "$TARGETARCH" = "arm64" ]; then apk add --no-cache qemu-x86_64; fi


# Tell Chisel where to find the preinstalled firtool instead of downloading one
ENV CHISEL_FIRTOOL_PATH=/opt/firtool/bin

Expand Down