enflow-api / Dockerfile
dhruv575
Docker updates
b780b82
raw
history blame contribute delete
918 Bytes
FROM python:3.9-slim
WORKDIR /app
# Install system dependencies for tesseract and pdf processing
RUN apt-get update && apt-get install -y \
tesseract-ocr \
poppler-utils \
libmagic1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user to run the application
RUN groupadd -r appuser && useradd -r -g appuser appuser
# Copy requirements and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Set environment variables
ENV PYTHONUNBUFFERED=1
# Create directories with proper permissions
RUN mkdir -p /tmp/uploads /tmp/logs && \
chmod 777 /tmp/uploads /tmp/logs && \
chown -R appuser:appuser /app
# Expose port for the Flask application
EXPOSE 7860
# Switch to non-root user
USER appuser
# Start the application with gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]