Files
Archivum/docker/Dockerfile
Bjorn Blomberg cd588197b9
All checks were successful
build-and-push / build (push) Successful in 15m15s
feat: Authentik OIDC SSO, allow/deny RBAC, admin console & Gitea CI
Authentication & RBAC
- Add confidential OIDC client (Authentik) with /auth/oidc/login +
  /auth/oidc/callback: discovery, code exchange, id_token verify (go-oidc),
  groups claim → role (Archivum-admin → admin, else user). Sessions carry groups.
- Rework ACL into an allow/deny model (new `effect` column + migration).
  db.EffectiveAccess resolves user + all groups over the path and its ancestors:
  default deny, explicit deny always beats allow.
- Enforce ACL for ALL non-admin users (not just guest) across list/read/save/
  delete/move/create/history/diff/images/upload. Admins bypass.
- Seed built-in Archivum-admin / Archivum-reader groups; login allow-list on
  users & groups; public (guest) user access is ACL-configurable.

Admin API & UI
- New GraphQL ops: oidcConfig/updateOidcConfig, group CRUD, membership,
  setUserRole/setUserLogin/setGroupLogin, userGroups, loginOptions.
- Rebuilt AdminView: SSO config, user/group management + membership, login
  toggles, and an allow/deny access-control matrix per path.
- LoginView: "Sign in with Authentik" + public-user option; OIDC callback route.

Rendering/editor
- Fix bug where inline marks (bold/italic/code/strike/link) were dropped on
  TipTap→AsciiDoc save. Add RENDERING_IMPROVEMENTS.md with proposals.

CI / build
- .gitea/workflows/build.yaml: build on the Pi5 runner, push
  localhost:5000/archivum:{latest,<sha>}. Add .dockerignore; bump Go image to 1.25.
- Docs: ARCHITECTURE.md, README.md, docs/AUTHENTIK_SETUP.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-05 21:58:50 +02:00

54 lines
2.3 KiB
Docker

# ── Stage 1: Build frontend ───────────────────────────────────────────────────
FROM node:20-alpine AS frontend-builder
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ ./
RUN npm run build
# ── Stage 2: Build backend ────────────────────────────────────────────────────
# Go 1.25 required by the OIDC dependency chain (go-oidc/v3, go-jose/v4).
FROM golang:1.25-alpine AS backend-builder
WORKDIR /app/backend
# Copy go.mod first for layer caching. go.sum is written by go mod download
# when it doesn't exist yet, or verified when it does.
COPY backend/go.mod ./
COPY backend/go.su[m] ./
RUN go mod download -x
COPY backend/ ./
# CGO disabled — pure Go SQLite (modernc.org/sqlite).
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /archivum ./cmd/server
# ── Stage 3: Runtime image ────────────────────────────────────────────────────
FROM alpine:3.20
# su-exec: lightweight tool to drop privileges (replaces gosu / setpriv).
# git: needed for wiki commit operations.
RUN apk add --no-cache su-exec git
# Create the app group and user that the entrypoint will run as.
# PUID/PGID can be overridden at runtime via environment variables;
# the entrypoint script uses them rather than these build-time values.
RUN addgroup -g 1000 archivum \
&& adduser -u 1000 -G archivum -s /sbin/nologin -D archivum
COPY --from=frontend-builder /app/frontend/dist /srv/archivum/ui
COPY --from=backend-builder /archivum /usr/local/bin/archivum
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
# Declare the volume mount points. The entrypoint creates subdirectories
# and fixes ownership before the application starts.
VOLUME ["/config", "/data"]
ENV DOCKER_PATH=/config \
UI_DIR=/srv/archivum/ui \
PUID=1000 \
PGID=1000
# Entrypoint runs as root so it can chown the volumes, then drops to PUID:PGID.
EXPOSE 4000
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]