Update Dockerfile
Browse files- Dockerfile +6 -3
Dockerfile
CHANGED
|
@@ -2,13 +2,15 @@
|
|
| 2 |
FROM node:18 AS frontend-builder
|
| 3 |
WORKDIR /frontend
|
| 4 |
|
| 5 |
-
# Install dependencies
|
| 6 |
COPY frontend/package.json frontend/package-lock.json* ./
|
| 7 |
RUN npm install
|
| 8 |
|
| 9 |
# Copy the rest of the frontend and build
|
| 10 |
COPY frontend .
|
| 11 |
RUN npm run build
|
|
|
|
|
|
|
| 12 |
|
| 13 |
# --------- 2) Backend (FastAPI + Python) ----------
|
| 14 |
FROM python:3.11-slim
|
|
@@ -22,8 +24,9 @@ RUN pip install --no-cache-dir -r /app/requirements.txt
|
|
| 22 |
# Copy backend code
|
| 23 |
COPY app /app
|
| 24 |
|
| 25 |
-
# Copy built frontend
|
| 26 |
-
|
|
|
|
| 27 |
|
| 28 |
EXPOSE 7860
|
| 29 |
|
|
|
|
| 2 |
FROM node:18 AS frontend-builder
|
| 3 |
WORKDIR /frontend
|
| 4 |
|
| 5 |
+
# Install dependencies for frontend
|
| 6 |
COPY frontend/package.json frontend/package-lock.json* ./
|
| 7 |
RUN npm install
|
| 8 |
|
| 9 |
# Copy the rest of the frontend and build
|
| 10 |
COPY frontend .
|
| 11 |
RUN npm run build
|
| 12 |
+
# NOTE: Your Vite config is writing output to ../app/frontend_dist
|
| 13 |
+
# So in this builder image, the built files are at: /app/frontend_dist
|
| 14 |
|
| 15 |
# --------- 2) Backend (FastAPI + Python) ----------
|
| 16 |
FROM python:3.11-slim
|
|
|
|
| 24 |
# Copy backend code
|
| 25 |
COPY app /app
|
| 26 |
|
| 27 |
+
# Copy built frontend from builder image into this final image
|
| 28 |
+
# IMPORTANT: we copy from /app/frontend_dist (not /frontend/dist)
|
| 29 |
+
COPY --from=frontend-builder /app/frontend_dist /app/frontend_dist
|
| 30 |
|
| 31 |
EXPOSE 7860
|
| 32 |
|