Skip to content

Add a Dockerfile to run with Docker #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]