NoteSnap / Dockerfile
Prateek-044's picture
Upload 24 files
e9cd410 verified
# Multi-stage Dockerfile for AI Notes Summarizer
# Stage 1: Base image with system dependencies
FROM python:3.10-slim as base
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
git \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user for security
RUN useradd --create-home --shell /bin/bash app
# Stage 2: Dependencies installation
FROM base as dependencies
# Set working directory
WORKDIR /app
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Stage 3: Application
FROM dependencies as application
# Copy application code
COPY --chown=app:app . .
# Create necessary directories
RUN mkdir -p /app/uploads /app/logs && \
chown -R app:app /app
# Switch to non-root user
USER app
# Expose port
EXPOSE 8501
# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8501/_stcore/health || exit 1
# Default command
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.headless=true", "--server.fileWatcherType=none", "--browser.gatherUsageStats=false"]