50 lines
1.1 KiB
Docker
50 lines
1.1 KiB
Docker
# UI Service Dockerfile
|
|
# FastAPI + Jinja2 + HTMX Dashboard
|
|
|
|
FROM python:3.14-alpine
|
|
|
|
# Prevent Python from writing .pyc files and enable unbuffered output
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
UI_PORT=8002 \
|
|
API_BASE=http://api:8001 \
|
|
BASE_PATH=""
|
|
|
|
# Create non-root user
|
|
RUN addgroup -g 10001 -S app && \
|
|
adduser -u 10001 -S app -G app
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apk add --no-cache \
|
|
curl \
|
|
gcc \
|
|
musl-dev \
|
|
linux-headers
|
|
|
|
# Install Python dependencies
|
|
COPY apps/ui/requirements.txt /app/requirements.txt
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application code
|
|
COPY apps/__init__.py /app/apps/__init__.py
|
|
COPY apps/ui/ /app/apps/ui/
|
|
|
|
# Change ownership to app user
|
|
RUN chown -R app:app /app
|
|
|
|
# Switch to non-root user
|
|
USER app
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:${UI_PORT}/health || exit 1
|
|
|
|
# Expose port
|
|
EXPOSE 8002
|
|
|
|
# Run application
|
|
CMD ["python", "-m", "uvicorn", "apps.ui.main:app", "--host", "0.0.0.0", "--port", "8002"]
|