2025-08-21 09:03:48 -07:00
|
|
|
# Use Python 3.11 slim image for smaller size
|
|
|
|
FROM python:3.11-slim
|
|
|
|
|
|
|
|
# Set working directory
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Set environment variables
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
|
|
|
|
# Install system dependencies if needed
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
gcc \
|
|
|
|
&& 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 code/ ./code/
|
|
|
|
COPY csv_files/ ./csv_files/
|
|
|
|
COPY mypy.ini .
|
|
|
|
|
2025-08-21 09:19:20 -07:00
|
|
|
# Create necessary directories as mount points
|
2025-08-21 09:03:48 -07:00
|
|
|
RUN mkdir -p deck_files logs
|
|
|
|
|
2025-08-21 09:19:20 -07:00
|
|
|
# Create volumes for persistent data
|
|
|
|
VOLUME ["/app/deck_files", "/app/logs", "/app/csv_files"]
|
|
|
|
|
2025-08-21 09:03:48 -07:00
|
|
|
# Set the working directory to code for proper imports
|
|
|
|
WORKDIR /app/code
|
|
|
|
|
2025-08-21 09:44:16 -07:00
|
|
|
# Create symbolic links so the app can find the data directories
|
|
|
|
RUN ln -sf /app/deck_files ./deck_files && \
|
|
|
|
ln -sf /app/logs ./logs && \
|
|
|
|
ln -sf /app/csv_files ./csv_files
|
|
|
|
|
2025-08-21 09:03:48 -07:00
|
|
|
# Run the application
|
|
|
|
CMD ["python", "main.py"]
|