diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ea9495f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,34 @@ +# Node modules (we'll install fresh in the image) +node_modules +npm-debug.log +yarn-error.log + +# Logs +logs +*.log + +# Environment files (optional for security) +.env +.env.* + +# OS & editor junk +.DS_Store +Thumbs.db +*.swp +*.swo +.idea +.vscode + +# Test coverage / build artifacts +coverage +dist +build +tmp +.cache + +# Git +.git +.gitignore + +# Dockerignore itself (not needed inside the image) +.dockerignore \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..93af5ef --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM node:23.11-alpine AS node_base +WORKDIR /app + +FROM node_base AS builder + +COPY package.json package-lock.json tsconfig.json ./ +RUN --mount=type=cache,target=/root/.npm npm ci --ignore-scripts --omit-dev + +COPY . ./ +RUN --mount=type=cache,target=/root/.npm-production npm run build + +FROM node_base AS release +COPY package.json package-lock.json ./ +COPY --from=builder /app/build ./build +ENV NODE_ENV=production +RUN --mount=type=cache,target=/root/.npm npm ci --ignore-scripts --omit-dev +ENTRYPOINT ["node", "/app/build/index.js"] \ No newline at end of file