FROM node:18-alpine
WORKDIR /app

COPY package.json package-lock.json ./

# Install deps (including devDeps, which includes nodemon)
RUN npm install

# Ensure the nodemon bin is executable
RUN chmod +x ./node_modules/.bin/nodemon

COPY . .

EXPOSE 5000

# Now npx can invoke it without permission issues
CMD ["node", "app.js"]