AutoAttend-AI / Dockerfile
kkt-2002's picture
Fix session persistence with Flask-Session
1465638
FROM python:3.11-slim
# Create user (required for Hugging Face security)
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# Set working directory
WORKDIR /app
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV TF_CPP_MIN_LOG_LEVEL=3
ENV CUDA_VISIBLE_DEVICES=-1
# Install system dependencies (switch to root temporarily)
USER root
RUN apt-get update && apt-get install -y \
libglib2.0-0 \
libsm6 \
libxext6 \
libgomp1 \
libgtk-3-0 \
libjpeg-dev \
libpng-dev \
ffmpeg \
curl \
&& rm -rf /var/lib/apt/lists/*
# Switch back to user
USER user
# Copy requirements and install Python dependencies
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY --chown=user:user . /app
# Create necessary directories
RUN mkdir -p app/static app/templates flask_session
# Expose Hugging Face port
EXPOSE 7860
# Run the application
CMD ["python", "app.py"]