auto-notification / Dockerfile
micymike's picture
Update Dockerfile
aa9ecf7 verified
Raw
History Blame Contribute Delete
1.09 kB
# Use Python 3.9 slim image for a smaller footprint
FROM python:3.9-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Create a non-root user
RUN useradd -m -u 1000 user
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements file
COPY --chown=user requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir gunicorn \
&& pip install --no-cache-dir --upgrade sentence_transformers \
&& pip install --no-cache-dir --upgrade langchain \
&& pip install --no-cache-dir -U langchain-community \
&& pip install --no-cache-dir -U langchain-huggingface \
&& pip install --no-cache-dir flask-cors
# Copy application code
COPY --chown=user . .
# Switch to non-root user
USER user
# Run the application
CMD ["gunicorn", "app:app", "-b", "0.0.0.0:7860", "--worker-class", "gevent", "--workers", "4", "--timeout", "120"]