XGB / Dockerfile
subbunanepalli's picture
Update Dockerfile
3da21a1 verified
# Use Python 3.9 slim image
FROM python:3.9-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
software-properties-common \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and install Python packages
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Create necessary writable directories
RUN mkdir -p /app/uploads \
/app/saved_models \
/app/predictions \
/app/tokenizer \
/app/cache/huggingface \
&& chmod -R 777 /app/uploads \
/app/saved_models \
/app/predictions \
/app/tokenizer \
/app/cache
# Copy all application files
COPY . /app/
COPY ../dataset_utils.py /app/
COPY ../train_utils.py /app/
COPY ../config.py /app/
COPY ../label_encoders.pkl /app/
# Set environment variables
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
ENV TRANSFORMERS_CACHE=/app/cache/huggingface
# Expose the FastAPI port
EXPOSE 7860
# Run the FastAPI app
CMD ["python", "app.py"]