Spaces:
Sleeping
Sleeping
yuvrajsingh6 commited on
Commit ·
a5856e8
1
Parent(s): 4bd4d1c
Fix: Install Node.js in runtime and update Groq version
Browse files- Dockerfile +9 -4
- backend/requirements.txt +1 -1
Dockerfile
CHANGED
|
@@ -12,14 +12,16 @@ RUN npm ci
|
|
| 12 |
COPY frontend-next/ ./
|
| 13 |
RUN npm run build
|
| 14 |
|
| 15 |
-
# Stage 2: Backend
|
| 16 |
FROM python:3.10-slim
|
| 17 |
|
| 18 |
WORKDIR /app
|
| 19 |
|
| 20 |
-
# Install
|
| 21 |
RUN apt-get update && apt-get install -y \
|
| 22 |
curl \
|
|
|
|
|
|
|
| 23 |
&& rm -rf /var/lib/apt/lists/*
|
| 24 |
|
| 25 |
# Copy backend files
|
|
@@ -33,12 +35,15 @@ COPY --from=frontend-builder /app/frontend/.next ./frontend/.next
|
|
| 33 |
COPY --from=frontend-builder /app/frontend/public ./frontend/public
|
| 34 |
COPY --from=frontend-builder /app/frontend/package*.json ./frontend/
|
| 35 |
COPY --from=frontend-builder /app/frontend/node_modules ./frontend/node_modules
|
|
|
|
|
|
|
| 36 |
|
| 37 |
# Create startup script
|
| 38 |
RUN echo '#!/bin/bash\n\
|
| 39 |
cd /app/backend && uvicorn main:app --host 0.0.0.0 --port 8000 &\n\
|
| 40 |
-
cd /app/frontend && npm start -- -p 7860\n\
|
| 41 |
-
wait
|
|
|
|
| 42 |
|
| 43 |
# Expose port
|
| 44 |
EXPOSE 7860
|
|
|
|
| 12 |
COPY frontend-next/ ./
|
| 13 |
RUN npm run build
|
| 14 |
|
| 15 |
+
# Stage 2: Python Backend with Static Frontend
|
| 16 |
FROM python:3.10-slim
|
| 17 |
|
| 18 |
WORKDIR /app
|
| 19 |
|
| 20 |
+
# Install Node.js for serving frontend
|
| 21 |
RUN apt-get update && apt-get install -y \
|
| 22 |
curl \
|
| 23 |
+
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
| 24 |
+
&& apt-get install -y nodejs \
|
| 25 |
&& rm -rf /var/lib/apt/lists/*
|
| 26 |
|
| 27 |
# Copy backend files
|
|
|
|
| 35 |
COPY --from=frontend-builder /app/frontend/public ./frontend/public
|
| 36 |
COPY --from=frontend-builder /app/frontend/package*.json ./frontend/
|
| 37 |
COPY --from=frontend-builder /app/frontend/node_modules ./frontend/node_modules
|
| 38 |
+
COPY --from=frontend-builder /app/frontend/next.config.mjs ./frontend/
|
| 39 |
+
COPY --from=frontend-builder /app/frontend/src ./frontend/src
|
| 40 |
|
| 41 |
# Create startup script
|
| 42 |
RUN echo '#!/bin/bash\n\
|
| 43 |
cd /app/backend && uvicorn main:app --host 0.0.0.0 --port 8000 &\n\
|
| 44 |
+
cd /app/frontend && npm start -- -p 7860 &\n\
|
| 45 |
+
wait -n\n\
|
| 46 |
+
exit $?' > /app/start.sh && chmod +x /app/start.sh
|
| 47 |
|
| 48 |
# Expose port
|
| 49 |
EXPOSE 7860
|
backend/requirements.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
fastapi==0.115.0
|
| 2 |
uvicorn[standard]==0.32.0
|
| 3 |
pandas==2.2.3
|
| 4 |
-
groq==0.
|
| 5 |
python-dotenv==1.0.1
|
|
|
|
| 1 |
fastapi==0.115.0
|
| 2 |
uvicorn[standard]==0.32.0
|
| 3 |
pandas==2.2.3
|
| 4 |
+
groq==0.15.0
|
| 5 |
python-dotenv==1.0.1
|