32 lines
794 B
Text
32 lines
794 B
Text
|
|
# Minimal FastAPI container for Heady remote access
|
||
|
|
FROM python:3.12-slim
|
||
|
|
|
||
|
|
# Prevent Python from writing pyc files and buffering
|
||
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
||
|
|
ENV PYTHONUNBUFFERED=1
|
||
|
|
|
||
|
|
# Set working directory
|
||
|
|
WORKDIR /app
|
||
|
|
|
||
|
|
# Install minimal system dependencies
|
||
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||
|
|
git \
|
||
|
|
&& rm -rf /var/lib/apt/lists/*
|
||
|
|
|
||
|
|
# Copy requirements and install Python dependencies
|
||
|
|
COPY requirements.txt .
|
||
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
||
|
|
|
||
|
|
# Copy application code
|
||
|
|
COPY . .
|
||
|
|
|
||
|
|
# Create non-root user for security
|
||
|
|
RUN useradd --create-home --shell /bin/bash heady
|
||
|
|
RUN chown -R heady:heady /app
|
||
|
|
USER heady
|
||
|
|
|
||
|
|
# Expose port
|
||
|
|
EXPOSE 8000
|
||
|
|
|
||
|
|
# Run FastAPI with uvicorn
|
||
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|