Cuong2004 commited on
Commit
9a8eaac
·
1 Parent(s): d4abe4b

fix dockerfile

Browse files
Files changed (2) hide show
  1. .dockerignore +2 -51
  2. Dockerfile +16 -5
.dockerignore CHANGED
@@ -1,54 +1,5 @@
1
- # Dependencies
2
  node_modules
3
- npm-debug.log*
4
- yarn-debug.log*
5
- yarn-error.log*
6
- package-lock.json
7
-
8
- # Build output
9
- dist
10
-
11
- # Environment files
12
- .env
13
- .env.*
14
- !.env.example
15
-
16
- # IDE
17
- .vscode
18
- .idea
19
- *.swp
20
- *.swo
21
- *~
22
-
23
- # OS
24
- .DS_Store
25
- Thumbs.db
26
-
27
- # Git
28
  .git
29
  .gitignore
30
- .gitattributes
31
-
32
- # Testing
33
- coverage
34
- .nyc_output
35
- test_api_usecases.js
36
- test-websocket.js
37
-
38
- # Documentation (keep README.md for HF Spaces)
39
- BE_Document.md
40
- AI Agent.md
41
-
42
- # Logs
43
- *.log
44
- logs
45
-
46
- # Temporary files
47
- *.tmp
48
- .cache
49
-
50
- # Docker
51
- Dockerfile
52
- .dockerignore
53
- docker-compose.yml
54
-
 
 
1
  node_modules
2
+ npm-debug.log
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  .git
4
  .gitignore
5
+ .env
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Dockerfile CHANGED
@@ -5,11 +5,17 @@ FROM node:18-alpine AS builder
5
  WORKDIR /app
6
 
7
  # Copy package files
8
- COPY package*.json ./
 
9
  COPY tsconfig.json ./
10
 
11
  # Install all dependencies (including devDependencies for build)
12
- RUN npm ci --legacy-peer-deps
 
 
 
 
 
13
 
14
  # Copy source code
15
  COPY src ./src
@@ -27,11 +33,16 @@ WORKDIR /app
27
  RUN apk add --no-cache dumb-init
28
 
29
  # Copy package files
30
- COPY package*.json ./
 
31
 
32
  # Install production dependencies only
33
- RUN npm ci --only=production --legacy-peer-deps && \
34
- npm cache clean --force
 
 
 
 
35
 
36
  # Copy built files from builder stage
37
  COPY --from=builder /app/dist ./dist
 
5
  WORKDIR /app
6
 
7
  # Copy package files
8
+ COPY package.json ./
9
+ COPY package-lock.json* ./
10
  COPY tsconfig.json ./
11
 
12
  # Install all dependencies (including devDependencies for build)
13
+ # Use npm ci if package-lock.json exists, otherwise use npm install
14
+ RUN if [ -f package-lock.json ]; then \
15
+ npm ci --legacy-peer-deps; \
16
+ else \
17
+ npm install --legacy-peer-deps; \
18
+ fi
19
 
20
  # Copy source code
21
  COPY src ./src
 
33
  RUN apk add --no-cache dumb-init
34
 
35
  # Copy package files
36
+ COPY package.json ./
37
+ COPY package-lock.json* ./
38
 
39
  # Install production dependencies only
40
+ # Use npm ci if package-lock.json exists, otherwise use npm install
41
+ RUN if [ -f package-lock.json ]; then \
42
+ npm ci --only=production --legacy-peer-deps && npm cache clean --force; \
43
+ else \
44
+ npm install --only=production --legacy-peer-deps && npm cache clean --force; \
45
+ fi
46
 
47
  # Copy built files from builder stage
48
  COPY --from=builder /app/dist ./dist