# Use official Python 3.10 slim image for a smaller footprint FROM python:3.10-slim # Set environment variables ENV TRANSFORMERS_CACHE=/app/cache \ HF_HOME=/app/cache \ USE_QUANTIZATION=0 \ DEVICE=-1 \ MAX_TEXT_LENGTH=5000 # Set working directory WORKDIR /app # Create the /app directory explicitly to avoid copy errors RUN mkdir -p /app # Copy requirements file COPY requirements.txt . # Install system dependencies and Python packages # Note: libgomp1 is required for PyTorch RUN apt-get update && apt-get install -y \ gcc \ libgomp1 \ && rm -rf /var/lib/apt/lists/* \ && pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir -r requirements.txt # Copy application code COPY app.py . # Pastikan nama file cocok # Create cache and logs directories with write permissions RUN mkdir -p /app/cache /app/logs \ && chmod -R 777 /app/cache /app/logs # Expose port for FastAPI EXPOSE 8000 # Run Uvicorn server CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]