FROM python:3.11-slim

# CUPSとその他必要なパッケージのインストール
RUN apt-get update && apt-get install -y \
    cups \
    cups-client \
    cups-bsd \
    gcc \
    libcups2-dev \
    python3-dev \
    && rm -rf /var/lib/apt/lists/*

RUN echo 'Listen 0.0.0.0:631' >> /etc/cups/cupsd.conf && \
    echo 'Listen /var/run/cups/cups.sock' >> /etc/cups/cupsd.conf && \
    echo 'LogLevel debug' >> /etc/cups/cupsd.conf && \
    echo 'MaxLogSize 0' >> /etc/cups/cupsd.conf && \
    echo 'ServerAlias *' >> /etc/cups/cupsd.conf && \
    echo 'DefaultEncryption Never' >> /etc/cups/cupsd.conf

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY ./app .

COPY startup.sh /
RUN chmod +x /startup.sh

