-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
63 lines (49 loc) · 1.67 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Use debian:testing since we need rust v1.64
FROM debian:testing-slim as testing
RUN apt-get update && \
apt-get install -y --no-install-recommends \
dbus curl ca-certificates build-essential git
WORKDIR /rust
# Install rust. Recommended install does not work in all docker
# architectures, as it fails to detect the right architecture when using
# buildx
COPY install-rust.sh ./
RUN ./install-rust.sh
WORKDIR /app
COPY Cargo.toml Cargo.lock ./
COPY src ./src
RUN . "$HOME/.cargo/env" && \
# See https://blog.rust-lang.org/inside-rust/2023/01/30/cargo-sparse-protocol.html
CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse cargo build --release
COPY run-tests.sh /
CMD ["/run-tests.sh"]
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
dbus systemd-sysv \
&& rm -rf /var/lib/apt/lists/*
# We want to use the multi-user.target not graphical.target
RUN systemctl set-default multi-user.target \
# We never want these to run in a container
&& systemctl mask \
apt-daily.timer \
apt-daily-upgrade.timer \
dev-hugepages.mount \
dev-mqueue.mount \
sys-fs-fuse-connections.mount \
sys-kernel-config.mount \
sys-kernel-debug.mount \
display-manager.service \
getty@.service \
systemd-logind.service \
systemd-remount-fs.service \
getty.target \
graphical.target
# Copy the start script
COPY start.sh /
# Install and enable the mock-logind service
COPY --from=testing /app/target/release/mock-logind /usr/bin/
COPY mock-logind.service /etc/systemd/system
RUN systemctl enable mock-logind.service
CMD ["/start.sh"]
# Set the stop signal to SIGRTMIN+3 which systemd understands as the signal to halt
STOPSIGNAL SIGRTMIN+3