0019c086cf
- Add VERSION file at repo root as single source of truth for app version
- frontend/vite.config.ts reads VERSION file instead of package.json
- backend config.py exposes APP_VERSION read from VERSION (dev) or /app/VERSION (Docker)
- database.py backs up DB to homelab.db.back-{version} before running migrations
(skipped if DB doesn't exist or backup already exists — fully idempotent)
- Dockerfile.backend and Dockerfile.frontend copy VERSION into the image
- Add test_db_backup.py with 4 tests covering create/skip/idempotent/version cases
33 lines
999 B
Docker
33 lines
999 B
Docker
# Stage 1: build
|
|
# Use the native build platform so npm ci never runs under QEMU emulation.
|
|
# The build output (static HTML/JS/CSS) is platform-independent.
|
|
# node:20-slim (Debian/glibc) avoids lightningcss musl binary resolution issues on Alpine.
|
|
FROM --platform=$BUILDPLATFORM node:20-slim AS builder
|
|
|
|
ARG VITE_STANDALONE=false
|
|
ENV VITE_STANDALONE=$VITE_STANDALONE
|
|
|
|
WORKDIR /app
|
|
COPY frontend/package*.json ./
|
|
RUN npm ci
|
|
|
|
COPY frontend/ .
|
|
COPY VERSION ../VERSION
|
|
RUN npm run build
|
|
|
|
# Stage 2: serve
|
|
FROM nginx:alpine
|
|
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# Nginx config: use standalone config (no backend proxy) or full config
|
|
ARG VITE_STANDALONE=false
|
|
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY docker/nginx.standalone.conf /etc/nginx/conf.d/nginx.standalone.conf
|
|
RUN if [ "$VITE_STANDALONE" = "true" ]; then \
|
|
cp /etc/nginx/conf.d/nginx.standalone.conf /etc/nginx/conf.d/default.conf; \
|
|
fi && \
|
|
rm /etc/nginx/conf.d/nginx.standalone.conf
|
|
|
|
EXPOSE 80
|