From df3d86a219d36d4e27ddc22e230dcfb127417e4f Mon Sep 17 00:00:00 2001 From: Joe Date: Sat, 21 Jun 2025 23:26:58 +0300 Subject: [PATCH] feat: add dockerfile --- Dockerfile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..810907d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +# Build Stage +FROM node:24-alpine AS builder + +WORKDIR /app + +COPY package*.json ./ +RUN apk add --no-cache --virtual .gyp python3 make g++ \ + && npm ci --omit=optional \ + && apk del .gyp + +COPY tsconfig.json ./ +COPY src ./src +COPY exampleconfig.json ./exampleconfig.json +COPY config.json ./config.json +RUN npm run build +RUN npm prune --omit=dev --omit=optional + +# Runtime Stage +FROM node:24-alpine AS runtime + +USER node +WORKDIR /app + +COPY --from=builder /app/dist ./dist +COPY --from=builder /app/package.json ./ +COPY --from=builder /app/package-lock.json ./ +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/config.json ./config.json + +EXPOSE 3000 +ENV PORT=3000 + +CMD ["node", "./dist/index.js"]