# Elorasmus: the server uses only Node's standard library, so there is no npm install step.
FROM docker.io/library/node:26.13.0-alpine3.24

ENV NODE_ENV=production \
    HOST=0.0.0.0 \
    PORT=8317 \
    DATA_DIR=/data

WORKDIR /app
COPY package.json ./
COPY server ./server
COPY public ./public

# /data holds picks, notes and settings. Owned by the image's unprivileged "node" user so a
# fresh named volume is writable (Docker and Podman both copy this ownership into it).
RUN mkdir -p /data && chown node:node /data
USER node
VOLUME ["/data"]
EXPOSE 8317
CMD ["node", "server/index.js"]
