Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +13 -32
Dockerfile
CHANGED
|
@@ -1,49 +1,30 @@
|
|
| 1 |
-
|
| 2 |
-
FROM python:3.9-slim AS backend
|
| 3 |
-
|
| 4 |
-
WORKDIR /app
|
| 5 |
-
|
| 6 |
-
# Copy backend code and requirements
|
| 7 |
-
COPY ./backend ./backend
|
| 8 |
-
COPY ./distance.py ./distance.py
|
| 9 |
-
COPY ./area.py ./area.py
|
| 10 |
-
COPY ./coordinate_converter.py ./coordinate_converter.py
|
| 11 |
-
COPY ./terrain.py ./terrain.py
|
| 12 |
-
COPY requirements.txt .
|
| 13 |
-
|
| 14 |
-
# Install Python dependencies
|
| 15 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
-
|
| 17 |
-
# --- Frontend static stage ---
|
| 18 |
-
FROM nginx:alpine AS frontend
|
| 19 |
|
| 20 |
WORKDIR /app
|
| 21 |
-
COPY ./frontend /app/frontend
|
| 22 |
-
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
|
| 26 |
|
| 27 |
-
|
|
|
|
| 28 |
|
| 29 |
-
# Copy
|
| 30 |
-
COPY
|
| 31 |
|
| 32 |
-
# Copy
|
| 33 |
-
COPY
|
| 34 |
-
COPY --from=frontend /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
|
| 35 |
|
| 36 |
-
# Install
|
| 37 |
-
RUN pip install --no-cache-dir
|
| 38 |
|
| 39 |
# Install nginx
|
| 40 |
RUN apt-get update && apt-get install -y nginx && rm -rf /var/lib/apt/lists/*
|
| 41 |
|
| 42 |
-
# Copy nginx config
|
| 43 |
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
| 44 |
|
| 45 |
# Expose the port nginx will listen on
|
| 46 |
EXPOSE 7860
|
| 47 |
|
| 48 |
-
# Start
|
| 49 |
CMD uvicorn backend.main:app --host 0.0.0.0 --port 8000 & nginx -g 'daemon off;'
|
|
|
|
| 1 |
+
FROM python:3.9-slim
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
# Copy backend code
|
| 6 |
+
COPY backend /app/backend
|
| 7 |
|
| 8 |
+
# Copy backend utility modules (if any are outside /backend, add more COPY lines)
|
| 9 |
+
# (Not needed if all are in /backend)
|
| 10 |
|
| 11 |
+
# Copy frontend static files
|
| 12 |
+
COPY frontend /app/frontend
|
| 13 |
|
| 14 |
+
# Copy requirements
|
| 15 |
+
COPY backend/requirements.txt /app/requirements.txt
|
|
|
|
| 16 |
|
| 17 |
+
# Install dependencies
|
| 18 |
+
RUN pip install --no-cache-dir -r /app/requirements.txt
|
| 19 |
|
| 20 |
# Install nginx
|
| 21 |
RUN apt-get update && apt-get install -y nginx && rm -rf /var/lib/apt/lists/*
|
| 22 |
|
| 23 |
+
# Copy nginx config
|
| 24 |
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
| 25 |
|
| 26 |
# Expose the port nginx will listen on
|
| 27 |
EXPOSE 7860
|
| 28 |
|
| 29 |
+
# Start FastAPI backend and nginx
|
| 30 |
CMD uvicorn backend.main:app --host 0.0.0.0 --port 8000 & nginx -g 'daemon off;'
|