Spaces:
Sleeping
Sleeping
havinashpatil commited on
Commit ·
da3a03d
1
Parent(s): 99213a1
Update Dockerfile to build frontend for Spaces deployment
Browse files- Dockerfile +14 -1
Dockerfile
CHANGED
|
@@ -2,11 +2,24 @@ FROM python:3.10-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
#
|
| 6 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 7 |
build-essential \
|
|
|
|
|
|
|
|
|
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
COPY requirements.txt .
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install Node.js for building frontend
|
| 6 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 7 |
build-essential \
|
| 8 |
+
curl \
|
| 9 |
+
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
|
| 10 |
+
&& apt-get install -y nodejs \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
+
# Build frontend
|
| 14 |
+
COPY frontend/package*.json ./frontend/
|
| 15 |
+
WORKDIR /app/frontend
|
| 16 |
+
RUN npm install
|
| 17 |
+
COPY frontend/ .
|
| 18 |
+
RUN npm run build
|
| 19 |
+
|
| 20 |
+
WORKDIR /app
|
| 21 |
+
|
| 22 |
+
# Install Python dependencies
|
| 23 |
COPY requirements.txt .
|
| 24 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 25 |
|