All checks were successful
Build and Push Docker Image / build (push) Successful in 15s
- Use /api/auth/login for UniFi OS controllers (UDM, Cloud Gateway) - Use /api/login for standalone controllers - Refactor to use FastMCP's native mcp.run() with custom_route for /health - Switch to network_mode: host for local network access - Include README.md in Dockerfile for hatchling build
40 lines
927 B
Docker
40 lines
927 B
Docker
# Build stage
|
|
FROM python:3.12-slim AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install build dependencies
|
|
RUN pip install --no-cache-dir uv
|
|
|
|
# Copy dependency files and README (required by hatchling)
|
|
COPY pyproject.toml README.md ./
|
|
|
|
# Create virtual environment and install dependencies
|
|
RUN uv venv /app/.venv
|
|
ENV PATH="/app/.venv/bin:$PATH"
|
|
RUN uv pip install --no-cache .
|
|
|
|
# Runtime stage
|
|
FROM python:3.12-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy virtual environment from builder
|
|
COPY --from=builder /app/.venv /app/.venv
|
|
ENV PATH="/app/.venv/bin:$PATH"
|
|
|
|
# Copy application code
|
|
COPY server.py unifi_client.py api_docs.py ./
|
|
|
|
# Create non-root user
|
|
RUN useradd --create-home --shell /bin/bash appuser
|
|
USER appuser
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["python", "server.py"]
|