FROM python:3.11-slim

ENV PYTHONUNBUFFERED=1 \
    NODEDC_BIM_CONVERTER_UPLOADS_DIR=/beam/uploads \
    NODEDC_BIM_CONVERTER_INTERVAL_SECONDS=10

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        libgl1 \
        libglib2.0-0 \
        libglu1-mesa \
        nodejs \
        npm \
        libsm6 \
        libxext6 \
        libxrender1 \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
RUN npm install -g @xeokit/xeokit-convert@1.3.2 \
    && npm cache clean --force

COPY . ./

CMD ["python", "worker.py"]
