Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +16 -4
Dockerfile
CHANGED
|
@@ -12,6 +12,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 12 |
COPY backend /app/backend
|
| 13 |
COPY frontend /app/frontend
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
# Create directories nginx can write to
|
| 16 |
RUN mkdir -p /tmp/nginx/client_body \
|
| 17 |
/tmp/nginx/proxy \
|
|
@@ -46,10 +49,15 @@ http {\n\
|
|
| 46 |
server {\n\
|
| 47 |
listen 7860;\n\
|
| 48 |
server_name localhost;\n\
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
location / {\n\
|
| 50 |
-
|
| 51 |
-
index index.html;\n\
|
| 52 |
-
try_files \$uri \$uri/ =404;\n\
|
| 53 |
}\n\
|
| 54 |
location /api/ {\n\
|
| 55 |
proxy_pass http://localhost:8000/api/;\n\
|
|
@@ -68,11 +76,15 @@ RUN pip install --no-cache-dir fastapi uvicorn httpx pyproj python-multipart
|
|
| 68 |
RUN echo '#!/bin/bash\ncurl -f http://localhost:7860/ || exit 1' > /app/healthcheck.sh \
|
| 69 |
&& chmod +x /app/healthcheck.sh
|
| 70 |
|
| 71 |
-
# Create startup script
|
| 72 |
RUN echo '#!/bin/bash' > /app/start.sh && \
|
| 73 |
echo 'echo "Starting API server..."' >> /app/start.sh && \
|
| 74 |
echo 'uvicorn backend.main:app --host 0.0.0.0 --port 8000 &' >> /app/start.sh && \
|
| 75 |
echo 'echo "Starting Nginx..."' >> /app/start.sh && \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
echo 'nginx -g "daemon off;"' >> /app/start.sh && \
|
| 77 |
chmod +x /app/start.sh
|
| 78 |
|
|
|
|
| 12 |
COPY backend /app/backend
|
| 13 |
COPY frontend /app/frontend
|
| 14 |
|
| 15 |
+
# List directory structure for debugging
|
| 16 |
+
RUN ls -la /app/frontend
|
| 17 |
+
|
| 18 |
# Create directories nginx can write to
|
| 19 |
RUN mkdir -p /tmp/nginx/client_body \
|
| 20 |
/tmp/nginx/proxy \
|
|
|
|
| 49 |
server {\n\
|
| 50 |
listen 7860;\n\
|
| 51 |
server_name localhost;\n\
|
| 52 |
+
root /app/frontend;\n\
|
| 53 |
+
# Try to serve index.html directly\n\
|
| 54 |
+
index index.html;\n\
|
| 55 |
+
# Debug output for file paths\n\
|
| 56 |
+
location = / {\n\
|
| 57 |
+
try_files /index.html =404;\n\
|
| 58 |
+
}\n\
|
| 59 |
location / {\n\
|
| 60 |
+
try_files \$uri \$uri/ /index.html =404;\n\
|
|
|
|
|
|
|
| 61 |
}\n\
|
| 62 |
location /api/ {\n\
|
| 63 |
proxy_pass http://localhost:8000/api/;\n\
|
|
|
|
| 76 |
RUN echo '#!/bin/bash\ncurl -f http://localhost:7860/ || exit 1' > /app/healthcheck.sh \
|
| 77 |
&& chmod +x /app/healthcheck.sh
|
| 78 |
|
| 79 |
+
# Create startup script with improved debugging
|
| 80 |
RUN echo '#!/bin/bash' > /app/start.sh && \
|
| 81 |
echo 'echo "Starting API server..."' >> /app/start.sh && \
|
| 82 |
echo 'uvicorn backend.main:app --host 0.0.0.0 --port 8000 &' >> /app/start.sh && \
|
| 83 |
echo 'echo "Starting Nginx..."' >> /app/start.sh && \
|
| 84 |
+
echo 'echo "Files in frontend directory:"' >> /app/start.sh && \
|
| 85 |
+
echo 'ls -la /app/frontend' >> /app/start.sh && \
|
| 86 |
+
echo 'echo "Checking index.html:"' >> /app/start.sh && \
|
| 87 |
+
echo 'if [ -f "/app/frontend/index.html" ]; then echo "index.html exists"; else echo "index.html MISSING"; fi' >> /app/start.sh && \
|
| 88 |
echo 'nginx -g "daemon off;"' >> /app/start.sh && \
|
| 89 |
chmod +x /app/start.sh
|
| 90 |
|