diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3d5ed1b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +node_modules +.git +*.log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..73c2c69 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM node:20-alpine AS builder + +WORKDIR /app + +COPY package*.json ./ +RUN npm ci --only=production + +COPY index.js ./ + +FROM node:20-alpine + +WORKDIR /app + +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/index.js . + +RUN addgroup -g 1001 -S nodejs && \ + adduser -S nodejs -u 1001 + +USER nodejs + +EXPOSE 3000 + +CMD ["node", "index.js"]