45 lines
2.1 KiB
Docker
45 lines
2.1 KiB
Docker
# egui/eframe 0.35 (GUI) require rustc >= 1.92.
|
|
FROM rust:1.94.1-alpine3.22
|
|
|
|
RUN apk add --no-cache \
|
|
build-base \
|
|
binutils \
|
|
file \
|
|
musl-dev \
|
|
openssl-dev \
|
|
openssl-libs-static \
|
|
perl \
|
|
pkgconf \
|
|
linux-headers \
|
|
&& rustup target add x86_64-unknown-linux-musl
|
|
|
|
ENV CARGO_NET_OFFLINE=false \
|
|
RUSTFLAGS=-Ctarget-cpu=x86-64
|
|
|
|
WORKDIR /workspace/signer
|
|
|
|
COPY nostr_core_lib_rust /workspace/nostr_core_lib_rust
|
|
# GUI header icon widget (path dependency ../hamburger_morphing/rust/...).
|
|
COPY hamburger_morphing/rust /workspace/hamburger_morphing/rust
|
|
COPY signer /workspace/signer
|
|
|
|
RUN cargo build --release --target x86_64-unknown-linux-musl
|
|
RUN file target/x86_64-unknown-linux-musl/release/signer \
|
|
&& file target/x86_64-unknown-linux-musl/release/signer-client \
|
|
&& ! readelf -l target/x86_64-unknown-linux-musl/release/signer | grep -q 'INTERP'
|
|
|
|
# GUI smoke test: the pure-Rust X11 backend must render frames headlessly.
|
|
# No system X11/OpenGL libraries are installed in this image, which proves
|
|
# the binary loads none.
|
|
#
|
|
# Xvfb is driven directly instead of via xvfb-run: xvfb-run's SIGUSR1
|
|
# startup handshake hangs forever under busybox ash (its `wait` does not
|
|
# return on the trapped signal), which stalled the release build with Xvfb
|
|
# running and the client never launched. Polling for the display socket is
|
|
# deterministic, and timeout(1) bounds the client so a GUI hang fails the
|
|
# build instead of blocking it.
|
|
RUN apk add --no-cache xvfb \
|
|
&& sh -c 'Xvfb :99 -screen 0 1280x1024x24 -nolisten tcp & xvfb_pid=$!; i=0; while [ ! -S /tmp/.X11-unix/X99 ] && [ $i -lt 100 ]; do sleep 0.1; i=$((i+1)); done; if [ ! -S /tmp/.X11-unix/X99 ]; then echo "error: Xvfb did not start" >&2; kill $xvfb_pid 2>/dev/null; exit 1; fi; SIGNER_GUI_SMOKE_FRAMES=3 DISPLAY=:99 timeout 60 ./target/x86_64-unknown-linux-musl/release/signer --gui; status=$?; kill $xvfb_pid 2>/dev/null; exit $status'
|
|
|
|
CMD ["sh", "-c", "mkdir -p /out && cp target/x86_64-unknown-linux-musl/release/signer /out/signer && cp target/x86_64-unknown-linux-musl/release/signer-client /out/signer_client"]
|