# Use an official Python runtime as a parent image
FROM python:3.10-slim-bullseye

# Set the working directory in the container
WORKDIR /usr/src/app

# Install system dependencies
# We need cron, ffmpeg for video processing, and rsync for file syncing.
RUN apt-get update && apt-get install -y cron ffmpeg rsync cpulimit procps && rm -rf /var/lib/apt/lists/*

# Copy the application script and other necessary files
COPY timelapse_maker.py .
COPY crontab .
COPY entrypoint.sh .

# Give execution rights to the entrypoint script
RUN chmod +x entrypoint.sh

# Set the entrypoint for the container
ENTRYPOINT ["./entrypoint.sh"]
