# Use a lightweight Python base image
FROM python:3.13-slim-bookworm

# Set the working directory in the container
WORKDIR /app

# Install uv and dependencies
COPY pyproject.toml ./
RUN apt-get update && apt-get install -y cron \
    && rm -rf /var/lib/apt/lists/*
RUN pip install uv && uv sync

# Copy the application code
COPY szuru-eink.py ./
COPY epd/ ./epd/

# Copy the cron job script and crontab file
COPY cron_job.sh /usr/local/bin/cron_job.sh
COPY crontab /etc/cron.d/szuru-eink-cron

# Give execution rights on the cron job script
RUN chmod +x /usr/local/bin/cron_job.sh

# Apply cron job
RUN crontab /etc/cron.d/szuru-eink-cron

# Run cron
CMD ["cron", "-f"]
