Files

43 lines
1.1 KiB
Docker

# Production Dockerfile for AI Patient Onboarding FastAPI Backend
FROM python:3.11-slim as base
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
APP_ENV=production \
PORT=8000
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy dependency requirements
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application source code
COPY ./app ./app
COPY ./data ./data
# Create non-root system user and group for security
RUN groupadd -g 999 appuser && \
useradd -r -u 999 -g appuser appuser && \
mkdir -p /app/data /app/temp_audio /app/temp_docs && \
chown -R appuser:appuser /app
USER appuser
EXPOSE 8000
# Health check instruction
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# Production Uvicorn Server Command
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]