HR-Assistant / dockerfile.txt
HassanJalil's picture
Upload 13 files
0a9f9c2 verified
# BLUESCARF AI HR Assistant - Docker Configuration
# Optimized for production deployment with security and performance
# Use official Python runtime as base image
FROM python:3.9-slim
# Set metadata
LABEL maintainer="BLUESCARF ARTIFICIAL INTELLIGENCE"
LABEL description="RAG-based HR Assistant with Google Gemini AI"
LABEL version="1.0.0"
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
STREAMLIT_SERVER_PORT=8501 \
STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
STREAMLIT_SERVER_HEADLESS=true \
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
# Create non-root user for security
RUN groupadd -r appuser && useradd -r -g appuser appuser
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Create necessary directories with proper permissions
RUN mkdir -p /app/vector_db /app/logs /app/temp && \
chown -R appuser:appuser /app
# Switch to non-root user
USER appuser
# Health check to ensure the app is running
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8501/_stcore/health || exit 1
# Expose port
EXPOSE 8501
# Set default command
CMD ["streamlit", "run", "app.py", \
"--server.port=8501", \
"--server.address=0.0.0.0", \
"--server.headless=true", \
"--browser.gatherUsageStats=false", \
"--theme.primaryColor=#3b82f6", \
"--theme.backgroundColor=#ffffff", \
"--theme.secondaryBackgroundColor=#f8fafc"]
# Alternative command for development (uncomment for dev builds)
# CMD ["streamlit", "run", "app.py", "--server.runOnSave=true", "--server.enableCORS=true"]