-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
45 lines (31 loc) · 1.08 KB
/
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
43
44
45
# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Stage 1: Build the application
FROM node:18-alpine AS builder
# Set the working directory
WORKDIR /app
# Copy package.json and package-lock.json to the working directory
COPY package.json package-lock.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Build the TypeScript files
RUN npm run build
# Stage 2: Run the application
FROM node:18-alpine
# Set the working directory
WORKDIR /app
# Copy the build output from the builder stage
COPY --from=builder /app/build ./build
# Copy the package.json and package-lock.json
COPY --from=builder /app/package.json /app/package-lock.json ./
# Install husky
RUN npm install -g husky
# Install only production dependencies
RUN npm install --omit=dev
# Copy the .env.example file to .env if .env doesn't exist (For demonstration purposes, in real use case, .env should be provided at runtime)
RUN cp .env.example .env || true
# Expose the application port
EXPOSE 3000
# Start the application
CMD ["node", "build/index.js"]