File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ # Use Node.js with alpine for a lightweight environment
2+ FROM node:lts-alpine3.20 AS base
3+ # Install system dependencies required for the application
4+ RUN apk update && apk add --no-cache \
5+ python3 \
6+ make \
7+ g++ \
8+ ca-certificates
9+ # Set working directory
10+ WORKDIR /app
11+ # Copy `package.json` and `package-lock.json` to the container
12+ COPY package*.json ./
13+ # Copy the rest of the application source code
14+ COPY . .
15+ # Expose API port
16+ EXPOSE 4000
17+
18+ FROM base AS prod
19+ # Install only production dependencies
20+ RUN npm ci --omit=dev
21+ # Build the TypeScript application
22+ RUN npm run build
23+ # Start the Node.js application in prod mode
24+ CMD ["npm" , "start" ]
25+
26+ FROM base AS dev
27+ # Install dependencies (including dev)
28+ RUN npm ci
29+ # Start the Node.js application in dev mode
30+ CMD ["npm" , "dev" ]
You can’t perform that action at this time.
0 commit comments