diff --git a/Dockerfile b/Dockerfile index 702bfd2..818b40e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,22 @@ -FROM node:23-slim +FROM node:24-slim AS builder WORKDIR /usr/src/app +# Copy dependency files first +COPY package*.json ./ + +# Install production dependencies only +RUN npm ci --only=production && npm cache clean --force + +FROM node:24-slim + +WORKDIR /usr/src/app + +COPY --from=builder /usr/src/app/node_modules ./node_modules + +# Copy application code +COPY . . + EXPOSE 3000 -COPY package.json /usr/src/app/package.json - -RUN npm install - -USER node - -COPY . /usr/src/app/ - CMD ["npm", "start"] diff --git a/package.json b/package.json index e5f628f..19b95fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "no-as-service", - "version": "1.0.0", + "version": "1.0.1", "description": "A lightweight API that returns random rejection or no reasons.", "main": "index.js", "scripts": {