Files
furumi-ng/docker/Dockerfile

46 lines
1.1 KiB
Docker
Raw Normal View History

2026-03-11 00:23:04 +00:00
# Stage 1: Build the rust binary
2026-03-11 00:28:15 +00:00
FROM rust:1.88.0-bookworm AS builder
2026-03-11 00:23:04 +00:00
2026-03-11 00:25:21 +00:00
# Install supplementary dependencies that might be needed
2026-03-11 00:23:04 +00:00
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
protobuf-compiler \
2026-03-11 00:25:21 +00:00
cmake \
2026-03-11 00:23:04 +00:00
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app
# Option: Copy in root workspace files and source crates
COPY . .
2026-03-17 19:03:48 +00:00
ARG FURUMI_VERSION=dev
2026-03-11 00:23:04 +00:00
# Build only the server for release
2026-03-17 19:03:48 +00:00
RUN FURUMI_VERSION=${FURUMI_VERSION} cargo build --release --bin furumi-server
2026-03-11 00:23:04 +00:00
# Stage 2: Create the minimal runtime image
FROM debian:bookworm-slim
# Install system dependencies needed at runtime (like OpenSSL if dynamically linked)
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user
RUN useradd -ms /bin/bash appuser
WORKDIR /home/appuser
# Copy the binary from the builder stage
COPY --from=builder /usr/src/app/target/release/furumi-server /usr/local/bin/furumi-server
USER appuser
# Expose ports: 50051 (gRPC) and 9090 (Metrics)
EXPOSE 50051
EXPOSE 9090
# Command to run the server
ENTRYPOINT ["furumi-server"]