openserve 2.0.0

A modern, high-performance, AI-enhanced file server built in Rust
Documentation
# Multi-stage Dockerfile for OpenServe
# Stage 1: Build environment
FROM rust:1.75-slim as builder

# Install system dependencies
RUN apt-get update && apt-get install -y \
    pkg-config \
    libssl-dev \
    libsqlite3-dev \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Create app directory
WORKDIR /app

# Copy dependency files
COPY Cargo.toml Cargo.lock ./

# Create a dummy main.rs to build dependencies
RUN mkdir src && echo "fn main() {}" > src/main.rs

# Build dependencies (this layer will be cached)
RUN cargo build --release && rm -rf src

# Copy source code
COPY src ./src
COPY benches ./benches

# Build the application
RUN cargo build --release

# Stage 2: Runtime environment
FROM debian:bookworm-slim

# Install runtime dependencies
RUN apt-get update && apt-get install -y \
    ca-certificates \
    libssl3 \
    libsqlite3-0 \
    && rm -rf /var/lib/apt/lists/*

# Create non-root user
RUN useradd -r -s /bin/false -m -d /app openserve

# Set working directory
WORKDIR /app

# Copy binary from builder stage
COPY --from=builder /app/target/release/openserve /usr/local/bin/openserve

# Create necessary directories
RUN mkdir -p /app/files /app/data /app/logs /app/index && \
    chown -R openserve:openserve /app

# Copy configuration template
COPY docker/config.yml /app/config.yml.template

# Switch to non-root user
USER openserve

# Expose port
EXPOSE 8080

# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
    CMD curl -f http://localhost:8080/health || exit 1

# Set environment variables
ENV RUST_LOG=info
ENV OPENSERVE_HOST=0.0.0.0
ENV OPENSERVE_PORT=8080
ENV OPENSERVE_SERVE_PATH=/app/files

# Run the application
CMD ["openserve", "--host", "0.0.0.0", "--port", "8080", "/app/files"]