bardd commited on
Commit
d1e82b3
·
verified ·
1 Parent(s): 5855be2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -2
Dockerfile CHANGED
@@ -3,10 +3,16 @@ FROM node:20-alpine AS build
3
 
4
  WORKDIR /app
5
 
 
6
  COPY package*.json ./
 
 
7
  RUN npm ci
8
 
 
9
  COPY . .
 
 
10
  RUN npm run build
11
 
12
  # Production stage
@@ -14,10 +20,16 @@ FROM node:20-alpine AS production
14
 
15
  WORKDIR /app
16
 
17
- COPY --from=build /app/dist ./dist
18
- COPY --from=build /app/node_modules ./node_modules
19
  COPY package*.json ./
20
 
 
 
 
 
 
 
 
21
  ENV NODE_ENV production
22
  ENV PORT 7860
23
 
 
3
 
4
  WORKDIR /app
5
 
6
+ # Copy package.json and package-lock.json (if exists)
7
  COPY package*.json ./
8
+
9
+ # Install all dependencies, including devDependencies
10
  RUN npm ci
11
 
12
+ # Copy the rest of your application code
13
  COPY . .
14
+
15
+ # Build the application
16
  RUN npm run build
17
 
18
  # Production stage
 
20
 
21
  WORKDIR /app
22
 
23
+ # Copy package.json and package-lock.json (if exists)
 
24
  COPY package*.json ./
25
 
26
+ # Install only production dependencies
27
+ # Since there are no production dependencies, this step will be quick
28
+ RUN npm ci --only=production
29
+
30
+ # Copy built assets from the build stage
31
+ COPY --from=build /app/dist ./dist
32
+
33
  ENV NODE_ENV production
34
  ENV PORT 7860
35