DocGPT-Prod / Dockerfile
akhil-vaidya's picture
Upload 48 files
4304dd8 verified
raw
history blame contribute delete
937 Bytes
# Use an official Python runtime as a parent image
FROM python:3.10.12
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
NAME=DocGPT
# Create a non-root user
RUN useradd -m -u 1000 appuser
# Set the working directory in the container
WORKDIR /app
# Create uploads directory and set permissions
RUN mkdir -p /app/data/uploads && \
chown -R appuser:appuser /app
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application code
COPY --chown=appuser:appuser . .
# Switch to non-root user
USER appuser
# Make port 7860 available
EXPOSE 7860
# Run gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]