Files
wetter-server/Dockerfile
2026-04-03 22:24:22 +02:00

34 lines
1.1 KiB
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ── Build-Stage ────────────────────────────────────────────────────────────
FROM node:24-bookworm-slim AS build
WORKDIR /app
# Nur package*.json kopieren → besseres Layer-Caching
COPY package.json package-lock.json ./
# Native Module (better-sqlite3, serialport) kompilieren
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 make g++ \
&& npm ci --omit=dev \
&& apt-get purge -y python3 make g++ \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# ── Runtime-Stage ───────────────────────────────────────────────────────────
FROM node:24-bookworm-slim
WORKDIR /app
# node_modules aus Build-Stage übernehmen
COPY --from=build /app/node_modules ./node_modules
# Anwendungscode kopieren
COPY davis.js db.js wetter.js .env ./
# Datenbankverzeichnis als Volume
VOLUME ["/data"]
# Kein Port reine Backend-Anwendung
CMD ["node", "wetter.js"]