Build and run the message queue over Alpine

We prior stopped doing so for stability reasons, but this _should_ be tried
again.
This commit is contained in:
Luke Parker
2025-11-11 10:12:48 -05:00
parent 353683cfd2
commit a34f9f6164
6 changed files with 43 additions and 9 deletions

View File

@@ -143,12 +143,19 @@ WORKDIR /home/{user}
}
}
fn build_serai_service(prelude: &str, release: bool, features: &str, package: &str) -> String {
fn build_serai_service(
prelude: &str,
os: Os,
release: bool,
features: &str,
package: &str,
) -> String {
let profile = if release { "release" } else { "debug" };
let profile_flag = if release { "--release" } else { "" };
format!(
r#"
(match os {
Os::Debian => {
r#"
FROM rust:1.91-slim-trixie AS builder
COPY --from=mimalloc-debian libmimalloc.so /usr/lib
@@ -161,7 +168,25 @@ RUN apt install -y pkg-config libclang-dev clang
# Dependencies for the Serai node
RUN apt install -y make protobuf-compiler
"#
}
Os::Alpine => {
r#"
FROM rust:1.91-alpine AS builder
COPY --from=mimalloc-alpine libmimalloc.so /usr/lib
ENV LD_PRELOAD=libmimalloc.so
RUN apk update && apk upgrade
# Add dev dependencies
RUN apk add clang-dev
"#
}
})
.to_owned() +
&format!(
r#"
# Add the wasm toolchain
RUN rustup component add rust-src
RUN rustup target add wasm32v1-none
@@ -196,7 +221,7 @@ RUN --mount=type=cache,target=/root/.cargo \
cargo build {profile_flag} --features "{features}" -p {package} && \
mv /serai/target/{profile}/{package} /serai/bin
"#
)
)
}
pub fn write_dockerfile(path: PathBuf, dockerfile: &str) {