larpaso-website/Dockerfile.admin
Pascal Scholz 93178a24e3 Add login-protected admin editor for content and design
Adds a self-service editor at admin.larpaso.de so texts, images, links,
Impressum/Datenschutz, fonts, font sizes and colors can be changed without
a developer. All homepage/legal content moves into content/site.json and
a new content/theme.json drives every CSS color/font/size token; the
Astro pages read from these at build time.

The admin/ service (Node/Express) provides bcrypt+session login with
rate limiting, a schema-driven form UI (including a hex/RGB/alpha color
picker), image upload, and a publish action that runs the Astro build
and republishes into a volume shared with the nginx website container -
so edits go live without redeploying that container.

See DEPLOYMENT_ADMIN.md for the server-side setup steps.
2026-09-21 21:35:09 +02:00

32 lines
1.1 KiB
Text

# Runs the login-protected editor (admin/) alongside a full copy of the
# Astro project, so it can run `npm run build` itself when publishing edits.
FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY admin/package*.json admin/
RUN npm --prefix admin ci
COPY . .
# content/ (site.json + theme.json) and public/uploads are normally mounted
# as volumes (see DEPLOYMENT_ADMIN.md) so edits persist across redeploys.
# Keep an untouched copy of the defaults so a fresh volume can be seeded.
RUN mkdir -p /app/content.default \
&& cp /app/content/site.json /app/content.default/site.json \
&& cp /app/content/theme.json /app/content.default/theme.json
ENV NODE_ENV=production \
PROJECT_DIR=/app \
CONTENT_PATH=/app/content/site.json \
THEME_PATH=/app/content/theme.json \
UPLOAD_DIR=/app/public/uploads \
DIST_TARGET_DIR=/site-dist
EXPOSE 4321
COPY docker-entrypoint-admin-seed.sh /usr/local/bin/docker-entrypoint-admin-seed.sh
RUN chmod +x /usr/local/bin/docker-entrypoint-admin-seed.sh
ENTRYPOINT ["/usr/local/bin/docker-entrypoint-admin-seed.sh"]
CMD ["node", "admin/server.js"]