# WHAT: Lightweight Node.js image for the APS client UI
# WHY: Alpine keeps the image small; no native modules needed (no canvas, no bcrypt)
FROM node:20-alpine

WORKDIR /app

# WHAT: Copy package.json and install dependencies
# WHY: npm install works without a lock file; safer for NAS deployments where
#      package-lock.json may not be present in the build context
COPY package.json ./
RUN npm install --omit=dev

COPY . .

# WHAT: Expose the web server port
EXPOSE 3001

# WHAT: Health check so Container Manager can report container status
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
  CMD wget -qO- http://localhost:3001/health || exit 1

CMD ["node", "server.js"]
