Spaces:
Runtime error
Runtime error
Bibhu Mishra
commited on
Commit
·
ca41e99
1
Parent(s):
97dab2a
Fixed docker file
Browse files- Dockerfile +19 -8
Dockerfile
CHANGED
|
@@ -4,20 +4,31 @@ FROM node:20-alpine AS builder
|
|
| 4 |
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Install dependencies
|
|
|
|
|
|
|
|
|
|
| 8 |
COPY package*.json ./
|
| 9 |
-
RUN npm install
|
| 10 |
|
| 11 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
COPY . .
|
| 13 |
|
| 14 |
# Build the NestJS app
|
| 15 |
-
RUN
|
|
|
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
|
|
|
|
| 21 |
|
| 22 |
-
# Expose
|
| 23 |
EXPOSE 8080
|
|
|
|
|
|
| 4 |
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Install build tools for native dependencies
|
| 8 |
+
RUN apk add --no-cache python3 make g++
|
| 9 |
+
|
| 10 |
+
# Copy package.json and package-lock.json first for caching
|
| 11 |
COPY package*.json ./
|
|
|
|
| 12 |
|
| 13 |
+
# Install dependencies with verbose logging
|
| 14 |
+
RUN echo "Installing dependencies..." \
|
| 15 |
+
&& npm install --verbose
|
| 16 |
+
|
| 17 |
+
# Copy the rest of the app source code
|
| 18 |
COPY . .
|
| 19 |
|
| 20 |
# Build the NestJS app
|
| 21 |
+
RUN echo "Building NestJS API Gateway..." \
|
| 22 |
+
&& npm run build:apigateway --verbose
|
| 23 |
|
| 24 |
+
# Ensure libs/proto folder is copied into dist for runtime
|
| 25 |
+
RUN mkdir -p dist/libs/proto \
|
| 26 |
+
&& cp -r libs/proto dist/libs/
|
| 27 |
|
| 28 |
+
# Verify files in dist
|
| 29 |
+
RUN echo "Contents of dist folder:" \
|
| 30 |
+
&& ls -lR dist
|
| 31 |
|
| 32 |
+
# Expose port 8080 and start the application
|
| 33 |
EXPOSE 8080
|
| 34 |
+
CMD ["node", "dist/apps/apigateway/main.js"]
|