Added Dockerfile
Some checks failed
Publish Server Image / build-and-push-image (push) Failing after 25s
Some checks failed
Publish Server Image / build-and-push-image (push) Failing after 25s
This commit is contained in:
42
Dockerfile
Normal file
42
Dockerfile
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Stage 1: Build the rust binary
|
||||||
|
FROM rust:1.80-slim-bookworm AS builder
|
||||||
|
|
||||||
|
# Install system dependencies
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
pkg-config \
|
||||||
|
libssl-dev \
|
||||||
|
protobuf-compiler \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
# Option: Copy in root workspace files and source crates
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build only the server for release
|
||||||
|
RUN cargo build --release --bin furumi-server
|
||||||
|
|
||||||
|
# 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"]
|
||||||
Reference in New Issue
Block a user