[linux] Container test: sources through the build context (no host mounts), Docker or Podman, cleans up its image

This commit is contained in:
2026-11-17 13:12:54 +01:00
parent 5999847bce
commit a67acb2886
3 changed files with 33 additions and 17 deletions
+13 -1
View File
@@ -1,8 +1,20 @@
# The Linux target's integration test: Debian with real systemd as PID 1.
# The Linux target's integration test: Debian with real systemd as PID 1 and the test-only
# `deploy` example. Built from the repository root (tests/linux/run.sh); the sources go in through the
# build context, so no host folder is mounted.
FROM docker.io/library/rust:1-slim-trixie AS build
WORKDIR /src
COPY Cargo.toml Cargo.lock ./
COPY crates crates
RUN cargo build --locked --example deploy -p legatus-linux \
&& cp target/debug/examples/deploy /legatus-deploy-test
FROM docker.io/library/debian:trixie-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends systemd systemd-sysv python3 curl ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& systemctl mask systemd-logind.service getty.target console-getty.service
COPY --from=build /legatus-deploy-test /usr/local/bin/legatus-deploy-test
COPY tests/linux/scenario.sh /scenario.sh
STOPSIGNAL SIGRTMIN+3
CMD ["/sbin/init"]