| FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04 | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| DEBIAN_FRONTEND=noninteractive | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| python3 \ | |
| python3-pip \ | |
| python3-setuptools \ | |
| python3-dev \ | |
| build-essential \ | |
| git \ | |
| && apt-get clean \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create a working directory | |
| WORKDIR /app | |
| # Installa dipendenze | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Prepara directory di output con permessi corretti | |
| RUN mkdir -p ./model_checkpoints ./model /tmp/huggingface_cache /app/embedding && \ | |
| chmod 777 ./model_checkpoints ./model /tmp/huggingface_cache /app/embedding | |
| # Copia tutti i file necessari | |
| COPY *.py . | |
| COPY users.json . | |
| COPY run.sh . | |
| RUN chmod +x run.sh | |
| # Crea uno script per eseguire il processo e poi copiare i file | |
| #python generate_embeddings.py\n\ | |
| # Esegui lo script | |
| # Esponi la porta per l'interfaccia web | |
| EXPOSE 7860 | |
| # Set the entrypoint | |
| ENTRYPOINT ["./run.sh"] |