Commit
·
fd14144
1
Parent(s):
3e9e626
FIles
Browse files- Dockerfile +3 -1
- backend/app.py +7 -1
Dockerfile
CHANGED
@@ -39,7 +39,9 @@ COPY ./frontend /app/frontend
|
|
39 |
|
40 |
# Install frontend dependencies as root
|
41 |
USER root
|
42 |
-
RUN cd /app/frontend && npm install --legacy-peer-deps
|
|
|
|
|
43 |
|
44 |
# Fix permissions so the non-root user can access node_modules
|
45 |
RUN chown -R user:user /app/frontend/node_modules
|
|
|
39 |
|
40 |
# Install frontend dependencies as root
|
41 |
USER root
|
42 |
+
RUN cd /app/frontend && npm install --legacy-peer-deps && npm run build
|
43 |
+
|
44 |
+
USER user
|
45 |
|
46 |
# Fix permissions so the non-root user can access node_modules
|
47 |
RUN chown -R user:user /app/frontend/node_modules
|
backend/app.py
CHANGED
@@ -54,7 +54,13 @@ app.add_middleware(
|
|
54 |
allow_headers=["*"],
|
55 |
)
|
56 |
|
57 |
-
app.mount("/", StaticFiles(directory="/app/frontend/build", html=True), name="frontend")
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
def overlay_mask(base_image, mask_image, color_idx):
|
60 |
"""
|
|
|
54 |
allow_headers=["*"],
|
55 |
)
|
56 |
|
57 |
+
# app.mount("/", StaticFiles(directory="/app/frontend/build", html=True), name="frontend")
|
58 |
+
# Serve the React frontend
|
59 |
+
frontend_path = "/app/frontend/build"
|
60 |
+
if os.path.exists(frontend_path):
|
61 |
+
app.mount("/", StaticFiles(directory=frontend_path, html=True), name="frontend")
|
62 |
+
else:
|
63 |
+
print(f"Warning: Frontend build directory '{frontend_path}' does not exist.")
|
64 |
|
65 |
def overlay_mask(base_image, mask_image, color_idx):
|
66 |
"""
|