2026-03-18 02:52:53 +00:00
|
|
|
FROM rust:1.88.0-bookworm AS builder
|
|
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
|
pkg-config \
|
|
|
|
|
libssl-dev \
|
|
|
|
|
protobuf-compiler \
|
|
|
|
|
cmake \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
WORKDIR /usr/src/app
|
2026-04-08 14:51:52 +01:00
|
|
|
|
|
|
|
|
# 1. Copy workspace manifests and lock file (changes rarely → cached layer)
|
|
|
|
|
COPY Cargo.toml Cargo.lock ./
|
|
|
|
|
COPY furumi-common/Cargo.toml furumi-common/Cargo.toml
|
|
|
|
|
COPY furumi-server/Cargo.toml furumi-server/Cargo.toml
|
|
|
|
|
COPY furumi-client-core/Cargo.toml furumi-client-core/Cargo.toml
|
|
|
|
|
COPY furumi-mount-linux/Cargo.toml furumi-mount-linux/Cargo.toml
|
|
|
|
|
COPY furumi-mount-macos/Cargo.toml furumi-mount-macos/Cargo.toml
|
|
|
|
|
COPY furumi-agent/Cargo.toml furumi-agent/Cargo.toml
|
|
|
|
|
COPY furumi-web-player/Cargo.toml furumi-web-player/Cargo.toml
|
|
|
|
|
|
|
|
|
|
# 2. Create dummy sources so cargo can resolve and build dependencies
|
|
|
|
|
RUN mkdir -p furumi-common/src && echo "pub fn _dummy(){}" > furumi-common/src/lib.rs \
|
|
|
|
|
&& mkdir -p furumi-server/src && echo "fn main(){}" > furumi-server/src/main.rs \
|
|
|
|
|
&& mkdir -p furumi-client-core/src && echo "pub fn _dummy(){}" > furumi-client-core/src/lib.rs \
|
|
|
|
|
&& mkdir -p furumi-mount-linux/src && echo "fn main(){}" > furumi-mount-linux/src/main.rs \
|
|
|
|
|
&& mkdir -p furumi-mount-macos/src && echo "fn main(){}" > furumi-mount-macos/src/main.rs \
|
|
|
|
|
&& mkdir -p furumi-agent/src && echo "fn main(){}" > furumi-agent/src/main.rs \
|
|
|
|
|
&& mkdir -p furumi-web-player/src && echo "fn main(){}" > furumi-web-player/src/main.rs
|
|
|
|
|
|
|
|
|
|
# 3. Build dependencies only (this layer is cached until Cargo.toml/lock change)
|
|
|
|
|
RUN cargo build --release --bin furumi-web-player 2>/dev/null || true
|
|
|
|
|
|
|
|
|
|
# 4. Copy real source code
|
2026-03-18 02:52:53 +00:00
|
|
|
COPY . .
|
|
|
|
|
|
2026-04-08 14:51:52 +01:00
|
|
|
# 5. Touch sources to invalidate cargo's fingerprint for our crates (not deps)
|
|
|
|
|
RUN touch furumi-common/src/lib.rs furumi-web-player/src/main.rs
|
|
|
|
|
|
2026-03-18 02:52:53 +00:00
|
|
|
ARG FURUMI_VERSION=dev
|
|
|
|
|
RUN FURUMI_VERSION=${FURUMI_VERSION} cargo build --release --bin furumi-web-player
|
|
|
|
|
|
|
|
|
|
FROM debian:bookworm-slim
|
|
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
|
ca-certificates \
|
|
|
|
|
libssl-dev \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
RUN useradd -ms /bin/bash appuser
|
|
|
|
|
WORKDIR /home/appuser
|
|
|
|
|
|
|
|
|
|
COPY --from=builder /usr/src/app/target/release/furumi-web-player /usr/local/bin/furumi-web-player
|
|
|
|
|
|
|
|
|
|
USER appuser
|
|
|
|
|
|
|
|
|
|
EXPOSE 8080
|
|
|
|
|
|
|
|
|
|
ENTRYPOINT ["furumi-web-player"]
|