Skip to content

Commit 35a2c05

Browse files
cursor[bot]cursoragentAlexanderWagnerDev
authored
fix(docker): use rust-musl-cross builder for riscv64 multi-arch (#153)
rust:alpine has no riscv64 manifest, so Release docker-multiarch builds failed immediately on linux/riscv64. Switch the builder to ghcr.io/rust-cross/rust-musl-cross with TARGETARCH tags so amd64, arm64, and riscv64 all compile musl binaries for the Alpine runtime. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Alexander Wagner <info@alexanderwagnerdev.com>
1 parent de64c35 commit 35a2c05

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

Dockerfile

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
# Build stage (Alpine/musl — same libc as runtime; multi-arch friendly)
1+
# syntax=docker/dockerfile:1
2+
# Build stage (musl via rust-musl-cross — same libc as Alpine runtime; multi-arch)
23
# Standalone (default `docker compose` context `.`):
34
# docker build -t librtmp2-server .
45
# Monorepo (parent OpenRTMP with sibling librtmp2/):
56
# docker build -f librtmp2-server/Dockerfile .
6-
FROM rust:alpine AS builder
7+
ARG TARGETARCH=amd64
8+
FROM --platform=$BUILDPLATFORM ghcr.io/rust-cross/rust-musl-cross:${TARGETARCH}-musl AS builder
79

8-
# musl release builds static-link OpenSSL; need *-static pkgs for -lssl/-lcrypto.
9-
RUN apk add --no-cache \
10-
musl-dev openssl-dev openssl-libs-static pkgconf git ca-certificates
10+
# Static OpenSSL keeps the musl binary self-contained on Alpine runtime.
11+
RUN apt-get update \
12+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
13+
pkg-config libssl-dev ca-certificates git \
14+
&& rm -rf /var/lib/apt/lists/*
15+
16+
ENV OPENSSL_STATIC=1
1117

1218
ARG LIBRTMP2_GIT=https://github.com/OpenRTMP/librtmp2.git
1319
# Empty (default) = resolve librtmp2 normally via the crates.io `version`
@@ -40,7 +46,8 @@ RUN set -eu; \
4046
if [ -f /build/librtmp2/Cargo.toml ]; then \
4147
printf '\n[patch."https://github.com/OpenRTMP/librtmp2"]\nlibrtmp2 = { path = "../librtmp2" }\n' >> Cargo.toml; \
4248
fi; \
43-
cargo build --release --features cluster
49+
cargo build --release --features cluster; \
50+
install -Dm755 target/*/release/librtmp2-server /build/out/librtmp2-server
4451

4552
ARG APP_VERSION=""
4653
RUN version="$APP_VERSION" && \
@@ -58,7 +65,7 @@ RUN apk add --no-cache libgcc libstdc++ openssl ca-certificates wget \
5865
&& mkdir -p /data \
5966
&& chown openrtmp:openrtmp /data
6067

61-
COPY --from=builder /build/librtmp2-server/target/release/librtmp2-server /usr/local/bin/librtmp2-server
68+
COPY --from=builder /build/out/librtmp2-server /usr/local/bin/librtmp2-server
6269
COPY --from=builder /build/librtmp2-server/.env.example /etc/librtmp2-server/.env
6370
COPY --from=builder /build/VERSION /usr/local/share/openrtmp/VERSION
6471
COPY --from=builder /build/librtmp2-server/entrypoint.sh /usr/local/bin/entrypoint.sh

0 commit comments

Comments
 (0)