-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
42 lines (29 loc) · 995 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Use an official Node.js runtime as a parent image
FROM node:18-alpine AS build
# Set the working directory
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . .
# Install any needed packages
RUN npm install
# Compile the TypeScript code
RUN npm run build
# Use a smaller Node.js runtime for the release build
FROM node:18-alpine AS release
# Set the working directory
WORKDIR /app
# Copy compiled files from the build image
COPY --from=build /app/build /app/build
# Copy necessary package.json files
COPY --from=build /app/package.json /app/package-lock.json /app/
# Install only production dependencies
RUN npm install --omit=dev --ignore-scripts
# Set executable permissions
RUN chmod +x build/index.js
# Set production environment
ENV NODE_ENV=production
# Set the user to non-root for security
USER node
# Run the server
ENTRYPOINT ["node", "build/index.js"]