# Dockerfile
FROM python:3.9-slim

# Set the working directory
WORKDIR /app

# Install git and clean up
RUN apt-get update -q && \
    apt-get install -y git && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Clone the repository
RUN git clone --single-branch --branch master https://git.epicsparrow.com/Anselme/perefouras.git .

# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt

# give exec permissions to main
RUN chmod +x main.py

# Command to update the repo and run the script
CMD ["sh", "-c", "cd /app && git pull origin master && python main.py"]
