FROM python:3.11-slim

# Install system dependencies
RUN apt-get -y update

RUN apt-get install -y \
    pandoc\
    imagemagick \
    lmodern

RUN apt-get install -y \
    texlive-latex-recommended \
    texlive-fonts-recommended

RUN apt-get install -y \
    texlive-lang-french \
    texlive-luatex

RUN apt-get install -y \
    texlive-latex-extra \
    texlive-fonts-extra

# Set the working directory
WORKDIR /app

# Copy the requirements file
COPY requirements.txt .

# Install Python dependencies
RUN pip install -r requirements.txt

# Policy for ImageMagick
COPY conf/policy.xml /etc/ImageMagick-6/policy.xml

# Expose the application port
EXPOSE 8000

# Copy the application code
COPY conf ./conf
COPY font ./font
COPY resources ./resources
COPY styles ./styles
COPY *.py .
COPY *.lua .

# Run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]