Files
2026-07-13 13:29:13 +08:00

51 lines
1.4 KiB
Docker

# Use Python 3.11 slim image as base
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY app/ .
# Create directory for database and logs
RUN mkdir -p /app/data /app/logs
# Set environment variables
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
ENV DATABASE_PATH=/app/data/meeting_minutes.db
# Expose the port the app runs on
EXPOSE 5167
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD curl -f http://localhost:5167/get-meetings || exit 1
# Create non-root user for security
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
# Install gosu for safe user switching
RUN apt-get update && apt-get install -y gosu && rm -rf /var/lib/apt/lists/*
# Create entrypoint script to fix permissions at runtime
RUN echo '#!/bin/bash\n\
# Fix permissions for mounted data directory\n\
chown -R appuser:appuser /app/data 2>/dev/null || true\n\
# Switch to appuser and run the application\n\
exec gosu appuser "$@"' > /entrypoint.sh && chmod +x /entrypoint.sh
# Run the application via entrypoint
ENTRYPOINT ["/entrypoint.sh"]
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5167"]