rentcache/Dockerfile
Ryan Malloy f46bdc978e Add Docker Compose with Caddy reverse proxy integration
- Multi-stage Dockerfile with development and production modes
- Docker Compose with caddy-docker-proxy labels for HTTPS
- Domain configuration: DOMAIN=rentcache.l.supported.systems
- Comprehensive Makefile with development and production targets
- Support for external caddy network and Redis backend
- Health checks and proper volume management
- Environment configuration with .env file

Usage:
- make setup  # Complete setup
- make dev    # Development with hot reload
- make prod   # Production deployment
- URL: https://rentcache.l.supported.systems
2025-09-09 20:13:37 -06:00

68 lines
1.6 KiB
Docker

# Multi-stage Dockerfile for RentCache
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim AS base
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy dependency files
COPY pyproject.toml uv.lock ./
# Install dependencies
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-install-project --no-dev
# Copy source code
COPY src/ ./src/
COPY README.md LICENSE ./
# Install the project
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-editable
# Development stage
FROM base AS development
# Install development dependencies
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-editable
# Create non-root user
RUN groupadd -r rentcache && useradd -r -g rentcache rentcache
RUN chown -R rentcache:rentcache /app
USER rentcache
# Create data directories
RUN mkdir -p /app/data /app/logs
EXPOSE 8000
# Development command with hot reload
CMD ["uv", "run", "rentcache", "server", "--host", "0.0.0.0", "--port", "8000", "--reload"]
# Production stage
FROM base AS production
# Create non-root user
RUN groupadd -r rentcache && useradd -r -g rentcache rentcache
RUN chown -R rentcache:rentcache /app
USER rentcache
# Create data directories
RUN mkdir -p /app/data /app/logs
# Compile bytecode for better performance
ENV UV_COMPILE_BYTECODE=1
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# Production command
CMD ["uv", "run", "rentcache", "server", "--host", "0.0.0.0", "--port", "8000"]