RAG_AI / Dockerfile
WebashalarForML's picture
Update Dockerfile
78d0662 verified
# Use an official Python runtime as a parent image
FROM python:3.11-slim
# Set environment variables for Python
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# Set environment variables for Hugging Face cache
ENV TRANSFORMERS_CACHE=/app/cache \
HF_HOME=/app/cache
ENV MPLCONFIGDIR=/tmp
# Set the working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
libsm6 \
libxrender1 \
libxext6 \
file \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements file into the container at /app
COPY requirements.txt /app/
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Create and set permissions for the cache directory
RUN mkdir -p /app/cache /app/VectorDB /app/uploads /app/nltk_data /nltk_data && \
chmod -R 777 /app/cache /app/VectorDB /app/uploads /app/nltk_data /nltk_data
# Ensure all relevant directories have the correct permissions
RUN chmod -R 777 /app/VectorDB
RUN chmod -R 777 /app/uploads
RUN chmod -R 777 /app/nltk_data
RUN chmod -R 777 /nltk_data
RUN chmod -R 777 /app
# Copy the rest of the application code to /app
COPY . /app/
# Set environment variables for Flask
ENV FLASK_APP=app.py \
FLASK_ENV=production
# Expose the port the app runs on
EXPOSE 7860
# Command to run the application
CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "120", "app:app"]