-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (26 loc) · 881 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
# Build stage
FROM node:20-alpine as build-stage
WORKDIR /usr/src/app
# Copy TypeScript config
COPY tsconfig.json ./
# Copy package.json and package-lock.json (if available) to the working directory
COPY package*.json ./
# Install all dependencies and build your app
RUN npm install
COPY src src
RUN npm run build
# Production stage
FROM node:20-alpine as production-stage
WORKDIR /usr/src/app
# Copy package.json and package-lock.json (if available) for production dependencies
COPY package*.json ./
# Install only production dependencies
RUN npm install --only=production
# Copy static files
COPY ./static ./static
# Copy built assets from the build stage
COPY --from=build-stage /usr/src/app/dist ./dist
# Your application binds to port 3000, make sure the container exposes this port
EXPOSE 3000
# The command to run your application
CMD [ "node", "dist/index.js" ]