File tree Expand file tree Collapse file tree 1 file changed +4
-33
lines changed
Expand file tree Collapse file tree 1 file changed +4
-33
lines changed Original file line number Diff line number Diff line change 1- # Build stage with newer Node
2- FROM node:18-slim AS builder
3-
4- WORKDIR /app
5-
6- # Copy package files first for better caching
7- COPY package*.json ./
8-
9- # Install dependencies
10- RUN npm install --no-optional
11-
12- # Copy the rest of the application
13- COPY . .
14-
15- # Build the project
16- RUN npm run build
17-
18- # Verify build output exists
19- RUN ls -la lib/
20-
21- # Runtime stage with Node 12
1+ # Use Node 12 for testing
222FROM node:12-slim
233
244WORKDIR /app
@@ -40,23 +20,14 @@ COPY package*.json ./
4020# Install dependencies
4121RUN npm install --no-optional
4222
43- # Copy all files except lib directory first
44- COPY --chown=node:node . .
45-
46- # Remove any existing lib directory to ensure clean copy
47- RUN rm -rf lib
48-
49- # Copy built files from builder stage
50- COPY --from=builder /app/lib ./lib
51-
52- # Debug: Check current working directory and paths
53- RUN pwd && ls -la && echo "Contents of lib:" && ls -la lib/ && echo "Testing require path:" && node -e "console.log(require.resolve('./lib/error-handler'))"
23+ # Copy the rest of the application (including pre-built lib files)
24+ COPY . .
5425
5526# Fix mocha permissions
5627RUN chmod +x node_modules/.bin/mocha
5728
5829# Set environment variables
5930ENV NODE_ENV=test
6031
61- # Command to run tests only (build already done in previous stage)
32+ # Command to run tests
6233CMD ["npm", "run", "mocha"]
You can’t perform that action at this time.
0 commit comments