# Sridu admin service - settings page, imprint/privacy, lobby moderation,
# the leaderboard of the challenges, the bug-report inbox, the sound-pack library.
# Built from the repository root (it counts with the app's own game files):
#   docker build -f api/Dockerfile -t sridu-api .
FROM node:24-alpine
# (the updater tells Sridu's own images by this label - see docker/updater.mjs)
LABEL org.sridu.app="sridu" org.sridu.part="api"
WORKDIR /app
COPY api/package.json api/server.mjs api/md.mjs api/board.mjs api/lobby.mjs api/bugs.mjs api/visits.mjs api/update.mjs api/packs.mjs ./
COPY api/admin ./admin
COPY api/templates ./templates
# the app's icon for the tab of the admin page and of /imprint, /privacy
COPY icon.svg icon-180.png ./
# the version it is built with (the update page, and the User-Agent of the update check)
COPY sw.js ./
# the look and the building blocks the admin page shares with the app's static configurator (config.html)
COPY css/admin.css ./css/
COPY js/adminui.js ./js/
# the leaderboard checks every result with the same code the app plays with
COPY js/leaderboard.js js/trainboard.js js/verified.js js/progress.js js/challenges.js js/games.js js/moregames.js js/bot.js js/phrases.js js/board.js js/i18n.js ./js/
COPY api/entrypoint.sh /usr/local/bin/sridu-api
# su-exec: hand the data folder to PUID:PGID, then run as that user (entrypoint.sh).
# readable for every user, whatever modes the files had on the host
RUN apk add --no-cache su-exec \
 && chmod 755 /usr/local/bin/sridu-api \
 && chmod -R a+rX /app && mkdir -p /state
ENV NODE_ENV=production SRIDU_STATE=/state PORT=3000 PUID=1000 PGID=1000
VOLUME /state
EXPOSE 3000
ENTRYPOINT ["sridu-api"]
