FROM node:22-alpine

WORKDIR /app

COPY package*.json ./

RUN npm install --production && \
    apk add --no-cache wget

COPY . .

# Limit Node.js heap to prevent OOM kills
ENV NODE_OPTIONS="--max_old_space_size=256"

EXPOSE 5000

CMD ["npm", "start"]