From 89d47afc830216de5e2de0185484c7a6ecd00836 Mon Sep 17 00:00:00 2001 From: charles Date: Wed, 17 Dec 2025 23:43:35 -0800 Subject: [PATCH] add: Dockerfile --- Dockerfile | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e40cbd1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,48 @@ +# Build stage +FROM rust:1-bookworm as builder + +WORKDIR /usr/src/rikidown + +# Install build dependencies required for git2 and openssl +RUN apt-get update && apt-get install -y \ + cmake \ + pkg-config \ + libssl-dev \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* + +# Copy manifests to build dependencies first for caching +COPY Cargo.toml Cargo.lock ./ + +# Create a dummy main.rs to build dependencies +RUN mkdir src && echo "fn main() {}" > src/main.rs +RUN cargo build --release + +# Copy the actual source code +COPY src ./src + +# Touch the main file to force a rebuild of the application code +RUN touch src/main.rs +RUN cargo build --release + +# Runtime stage +FROM debian:bookworm-slim + +WORKDIR /app + +# Install runtime dependencies +# ca-certificates is required for git cloning over HTTPS +# libssl is required for the linked openssl dependency +RUN apt-get update && apt-get install -y \ + ca-certificates \ + libssl3 \ + && rm -rf /var/lib/apt/lists/* + +# Copy the compiled binary from the builder stage +COPY --from=builder /usr/src/rikidown/target/release/rikidown /usr/local/bin/rikidown + +# Expose the default listening port +EXPOSE 8080 + +# Set the entrypoint +ENTRYPOINT ["rikidown"]