-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.api
More file actions
47 lines (32 loc) · 877 Bytes
/
Dockerfile.api
File metadata and controls
47 lines (32 loc) · 877 Bytes
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
46
47
# Development stage
FROM node:20-alpine AS development
WORKDIR /app
# Copy package files
COPY package*.json ./
COPY lib/api-server/package*.json ./lib/api-server/
# Install dependencies
RUN npm install
# Copy source code
COPY . .
# Set working directory to api-server
WORKDIR /app/lib/api-server
# Expose the port the app runs on
EXPOSE 4000
# Command to run the application in development
CMD ["npm", "run", "dev"]
# Production stage
FROM node:20-alpine AS production
WORKDIR /app
# Copy package files
COPY package*.json ./
COPY lib/api-server/package*.json ./lib/api-server/
# Install production dependencies
RUN npm ci --only=production
# Copy built application
COPY . .
# Set working directory to api-server
WORKDIR /app/lib/api-server
# Expose the port the app runs on
EXPOSE 4000
# Command to run the application in production
CMD ["node", "src/index.js"]