40 lines
1.2 KiB
Docker
40 lines
1.2 KiB
Docker
# ObsiGate — Multi-platform Docker image
|
|
# Stage 1: Install Python dependencies (with build tools)
|
|
FROM python:3.11-slim AS builder
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends gcc libffi-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /build
|
|
COPY backend/requirements.txt .
|
|
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
|
|
|
|
# Stage 2: Final lightweight image (no build tools)
|
|
FROM python:3.11-slim
|
|
|
|
LABEL maintainer="Bruno Beloeil" \
|
|
version="1.1.0" \
|
|
description="ObsiGate — lightweight web interface for Obsidian vaults"
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy installed packages from builder stage
|
|
COPY --from=builder /install /usr/local
|
|
|
|
# Copy application code
|
|
COPY backend/ ./backend/
|
|
COPY frontend/ ./frontend/
|
|
|
|
# Create non-root user for security
|
|
RUN groupadd -r obsigate && useradd -r -g obsigate -d /app -s /sbin/nologin obsigate \
|
|
&& chown -R obsigate:obsigate /app
|
|
USER obsigate
|
|
|
|
EXPOSE 8080
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/api/health')" || exit 1
|
|
|
|
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8080"]
|