tubewatch/playlist-monitor/Dockerfile

42 lines
987 B
Docker

# Use Python 3.13 slim image
FROM python:3.13-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
g++ \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install uv package manager
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.cargo/bin:$PATH"
# Copy dependency files
COPY pyproject.toml ./
# Install Python dependencies
RUN uv sync --frozen
# Copy application code
COPY app/ ./app/
# Create data and logs directories
RUN mkdir -p /app/data /app/logs
# Create non-root user
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser
# Expose port
EXPOSE 8082
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD uv run python -c "import requests; requests.get('http://localhost:8082/api/health', timeout=5)"
# Run the application
CMD ["uv", "run", "python", "-m", "app.main"]