Files
lan-clipboard/Dockerfile
T
dbildhauerandClaude Opus 5.5 70af4341c9 build: dockerfile, compose und readme
- Multi-Stage-Build: Node baut das Frontend, python:3.13-slim liefert aus
- Entrypoint setzt Rechte für /data, migriert und startet Uvicorn als UID 1000
- Port nur an die LAN-IP gebunden (192.168.50.123:8085)
- Healthcheck gegen /api/health, reduzierte Capabilities, Speicherlimit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 11:04:33 +01:00

46 lines
1.4 KiB
Docker

# syntax=docker/dockerfile:1
# --- Stage 1: build the Vue frontend ---------------------------------------
FROM node:22.22.0-alpine AS frontend
WORKDIR /build
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci --no-fund --no-audit
COPY frontend/ ./
RUN npm run build
# --- Stage 2: Python runtime -----------------------------------------------
FROM python:3.13-slim AS runtime
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
RUN groupadd --system --gid 1000 app \
&& useradd --system --uid 1000 --gid app --home-dir /app --shell /usr/sbin/nologin app
WORKDIR /app
# Install dependencies first (stub package) so code changes keep the layer cached
COPY backend/pyproject.toml ./
RUN mkdir app && touch app/__init__.py && pip install . && rm -rf app build *.egg-info
COPY backend/app ./app
RUN pip install --no-deps . && rm -rf app build *.egg-info
COPY backend/alembic.ini ./
COPY backend/alembic ./alembic
COPY --from=frontend /build/dist ./static
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
ENV DATA_DIR=/data \
STATIC_DIR=/app/static
EXPOSE 8000
VOLUME ["/data"]
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD ["python", "-c", "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8000/api/health', timeout=4).status == 200 else 1)"]
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]