Skip to content

Commit faea4bf

Browse files
committed
Add a Dockerfile to run with Docker
Signed-off-by: David Gageot <[email protected]>
1 parent 9449810 commit faea4bf

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

.dockerignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Node modules (we'll install fresh in the image)
2+
node_modules
3+
npm-debug.log
4+
yarn-error.log
5+
6+
# Logs
7+
logs
8+
*.log
9+
10+
# Environment files (optional for security)
11+
.env
12+
.env.*
13+
14+
# OS & editor junk
15+
.DS_Store
16+
Thumbs.db
17+
*.swp
18+
*.swo
19+
.idea
20+
.vscode
21+
22+
# Test coverage / build artifacts
23+
coverage
24+
dist
25+
build
26+
tmp
27+
.cache
28+
29+
# Git
30+
.git
31+
.gitignore
32+
33+
# Dockerignore itself (not needed inside the image)
34+
.dockerignore

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM node:23.11-slim AS node_base
2+
WORKDIR /app
3+
4+
FROM node_base AS builder
5+
RUN npm install -g typescript shx
6+
7+
COPY package.json yarn.lock tsconfig.json ./
8+
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn yarn install --ignore-scripts --omit-dev
9+
10+
COPY . ./
11+
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn tsc && shx chmod +x dist/*.js
12+
13+
FROM node_base
14+
COPY package.json yarn.lock ./
15+
COPY --from=builder /app/dist ./dist
16+
ENV NODE_ENV=production
17+
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn yarn install --ignore-scripts --omit-dev
18+
ENTRYPOINT ["node", "/app/dist/index.js"]

0 commit comments

Comments
 (0)