Refactor UI/views, rework Docker build, untrack local data

- Views umstrukturiert: einstellungen.ejs -> bewerbung.ejs, neues
  partials/head.ejs, header/footer/index angepasst
- CSS umbenannt: style.css -> styles.css
- server.js und public/js/main.js ueberarbeitet
- Dockerfile auf schlankes Multi-Stage-Setup umgestellt;
  docker-compose.yml und .dockerignore entfernt
- npm-Scripts docker:build/push/deploy ergaenzt
- SQLite-DB und .idea aus Git entfernt und via .gitignore ignoriert

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-19 04:01:37 +02:00
parent 34cfcecc1e
commit c2a629e2c0
25 changed files with 3693 additions and 1886 deletions
+24 -14
View File
@@ -1,35 +1,45 @@
# ── Stage 1: Dependencies (mit Compiler für better-sqlite3) ──────────────────
FROM node:20.19.2-slim AS deps
# syntax=docker/dockerfile:1
# ----- Build stage: install (and compile native sqlite3) deps -----
FROM node:20-bookworm-slim AS builder
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 make g++ \
# Build toolchain required to compile the native sqlite3 binding
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 make g++ \
&& rm -rf /var/lib/apt/lists/*
# Install production dependencies deterministically (cached unless lockfile changes)
COPY package.json package-lock.json ./
RUN npm ci --omit=dev
# ── Stage 2: Runtime ──────────────────────────────────────────────────────────
FROM node:20.19.2-slim AS runtime
# ----- Runtime stage: slim image without build tooling -----
FROM node:20-bookworm-slim AS runtime
ENV NODE_ENV=production \
PORT=3000
WORKDIR /app
RUN groupadd --system --gid 1001 nodejs \
&& useradd --system --uid 1001 --gid nodejs --no-create-home appuser
# Bring in the already-installed (and compiled) dependencies
COPY --from=builder /app/node_modules ./node_modules
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN mkdir -p data && chown -R appuser:nodejs data
# Application source
COPY package.json ./
COPY server.js ./
COPY views ./views
COPY public ./public
# Persisted SQLite data lives here; make it writable for the non-root user
RUN mkdir -p /app/data && chown -R node:node /app
VOLUME ["/app/data"]
USER appuser
USER node
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD node -e "require('http').get('http://localhost:3000/',r=>process.exit(r.statusCode===200?0:1)).on('error',()=>process.exit(1))"
CMD node -e "fetch('http://localhost:'+(process.env.PORT||3000)+'/').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
CMD ["node", "server.js"]