Skip to content

Commit a8572bd

Browse files
committed
Add Dockerfile
1 parent 37088bc commit a8572bd

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Dockerfile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
2+
# Use Node.js image for building the project
3+
FROM node:20-alpine AS builder
4+
5+
# Set the working directory
6+
WORKDIR /app
7+
8+
# Copy package.json and package-lock.json
9+
COPY package.json package-lock.json ./
10+
11+
# Install dependencies without running scripts to prevent automatic build
12+
RUN npm install --ignore-scripts
13+
14+
# Copy the entire source directory
15+
COPY src ./src
16+
COPY tsconfig.json ./
17+
18+
# Build the project
19+
RUN npm run build
20+
21+
# Use a minimal Node.js image for running the project
22+
FROM node:20-alpine AS release
23+
24+
# Set the working directory
25+
WORKDIR /app
26+
27+
# Copy the built files from the builder stage
28+
COPY --from=builder /app/dist ./dist
29+
COPY --from=builder /app/package.json ./package.json
30+
COPY --from=builder /app/package-lock.json ./package-lock.json
31+
32+
# Install production dependencies
33+
RUN npm ci --ignore-scripts --omit=dev
34+
35+
# Set the command to run the server
36+
ENTRYPOINT ["node", "dist/index.js"]

0 commit comments

Comments
 (0)