Initial Commit

This commit is contained in:
Anders Böttcher
2026-05-11 23:39:16 +02:00
parent 9dde8d8804
commit 50566f2a22
38 changed files with 5840 additions and 1015 deletions
+46
View File
@@ -0,0 +1,46 @@
# syntax=docker/dockerfile:1
# ── Stage 1: deps ─────────────────────────────────────────────────────────────
FROM oven/bun:1 AS deps
WORKDIR /app
COPY frontend/package.json frontend/bun.lock* ./
RUN bun install --frozen-lockfile
# ── Stage 2: builder ──────────────────────────────────────────────────────────
FROM oven/bun:1 AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY frontend/ .
ENV NEXT_TELEMETRY_DISABLED=1
RUN bun run build
# ── Stage 3: runner ───────────────────────────────────────────────────────────
FROM oven/bun:1-slim AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
# Dedicated non-root user
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs
# Next.js standalone output
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
# Writable data directory for file uploads
RUN mkdir -p /app/data/uploads && chown -R nextjs:nodejs /app/data
USER nextjs
EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME=0.0.0.0
CMD ["bun", "server.js"]
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# build.sh — Build the backerup-website Docker image.
# Usage: ./docker/build.sh [TAG]
# TAG defaults to "backerup-website:latest"
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
TAG="${1:-backerup-website:latest}"
echo "==> Building image: $TAG"
docker build \
--file "$REPO_ROOT/docker/Dockerfile" \
--tag "$TAG" \
"$REPO_ROOT"
echo "==> Done. Image tagged as '$TAG'."
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# deploy.sh — Build the image and start (or restart) the local stack.
# Usage: ./docker/deploy.sh [TAG]
# TAG defaults to "backerup-website:latest"
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
TAG="${1:-backerup-website:latest}"
# 1. Build
"$SCRIPT_DIR/build.sh" "$TAG"
# 2. Export the image tag so docker compose picks it up if you override it
export BACKERUP_IMAGE="$TAG"
# 3. Bring the stack up (recreate on image change)
echo "==> Starting stack via docker compose…"
docker compose \
--file "$SCRIPT_DIR/docker-compose.yml" \
up --detach --pull never --remove-orphans
echo "==> Backerup website is running at http://localhost:3000"
+16
View File
@@ -0,0 +1,16 @@
services:
backerup-website:
image: backerup-website:latest
container_name: backerup-website
restart: unless-stopped
ports:
- "3000:3000"
volumes:
- backerup_data:/app/data
environment:
- NODE_ENV=production
- NEXT_TELEMETRY_DISABLED=1
volumes:
backerup_data:
driver: local