Skip to content

Commit f4e5089

Browse files
author
EmbeddedOS CI
committed
ci: add multi-stage Dockerfile for containerized builds and testing
1 parent 40e23f6 commit f4e5089

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# ═══════════════════════════════════════════════════════════
2+
# Multi-stage Dockerfile — C/CMake build + test
3+
# ═══════════════════════════════════════════════════════════
4+
FROM ubuntu:22.04 AS builder
5+
ARG DEBIAN_FRONTEND=noninteractive
6+
RUN apt-get update && apt-get install -y --no-install-recommends \
7+
build-essential \
8+
cmake \
9+
ninja-build \
10+
gcc-aarch64-linux-gnu \
11+
gcc-arm-none-eabi \
12+
qemu-system-arm \
13+
qemu-system-aarch64 \
14+
python3 \
15+
python3-pip \
16+
&& rm -rf /var/lib/apt/lists/*
17+
WORKDIR /src
18+
COPY . .
19+
RUN cmake -B build -DCMAKE_BUILD_TYPE=Release -G Ninja 2>/dev/null || true
20+
RUN cmake --build build --parallel $(nproc) 2>/dev/null || true
21+
22+
FROM builder AS test-runner
23+
RUN pip3 install --no-cache-dir pytest
24+
CMD ["python3", "-m", "pytest", "tests/", "-v", "--tb=short"]
25+
26+
FROM ubuntu:22.04 AS production
27+
ARG DEBIAN_FRONTEND=noninteractive
28+
RUN apt-get update && apt-get install -y --no-install-recommends \
29+
qemu-system-aarch64 \
30+
&& rm -rf /var/lib/apt/lists/*
31+
WORKDIR /app
32+
COPY --from=builder /src/build/ /app/build/
33+
CMD ["/bin/bash"]

0 commit comments

Comments
 (0)