Files
dungeoncraft/Dockerfile
T
Richard ZinkandClaude Opus 5.5 c9848c8948 User accounts, login before the title screen, own savegames per user, standalone download
- Service: accounts with Argon2 password hashes and session tokens; the first login creates
  the admin (shared savegames of before move to the admin); the admin creates and deletes
  users; everybody can change the password; savegames are stored and listed per user
- Game: login page before the title (only when the service is reachable), with licence and
  repository link; account page (password, logout; users for the admin); text fields with
  Tab/Enter, masked passwords, browser dialog on touch screens; long status messages wrap
- Download Standalone: DungeonCraft.html with the game embedded (built in the Docker image,
  served to logged-in users via nginx auth_request); works from file:// without server and
  opens downloaded savegames
- Without the service (standalone, local files) there is no login, savegame files as before

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 13:33:22 +01:00

34 lines
1.2 KiB
Docker

# --- Build: Rust -> WASM
FROM rust:1-slim AS build
RUN rustup target add wasm32-unknown-unknown
WORKDIR /src
COPY Cargo.toml Cargo.lock ./
COPY .cargo .cargo
# build dependencies first (Docker layer cache)
RUN mkdir src && echo "fn main() {}" > src/main.rs \
&& cargo build --release --target wasm32-unknown-unknown \
&& rm -rf src
COPY assets assets
COPY lang lang
COPY src src
RUN touch src/main.rs && cargo build --release --target wasm32-unknown-unknown \
&& mkdir /out \
&& cp target/wasm32-unknown-unknown/release/dungeoncraft.wasm /out/ \
&& cp "$CARGO_HOME"/registry/src/*/macroquad-*/js/mq_js_bundle.js /out/
# --- standalone: the whole game in one HTML file (downloadable for logged-in users)
FROM python:3-alpine AS standalone
WORKDIR /w
COPY www/ www/
COPY --from=build /out/ www/
COPY tools/make_standalone.py .
RUN mkdir -p /out/standalone && python3 make_standalone.py www /out/standalone/DungeonCraft.html
# --- serve: nginx
FROM nginx:alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY www/ /usr/share/nginx/html/
COPY --from=build /out/ /usr/share/nginx/html/
COPY --from=standalone /out/standalone/ /usr/share/nginx/html/standalone/
EXPOSE 80