-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.space
More file actions
35 lines (26 loc) · 782 Bytes
/
Dockerfile.space
File metadata and controls
35 lines (26 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# QPyth Docker Space - React Frontend + FastAPI Backend
FROM python:3.12-slim
# Install Node.js for building React
RUN apt-get update && apt-get install -y \
curl \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy Python requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy package files and install Node dependencies
COPY web/package*.json ./web/
RUN cd web && npm install
# Copy all source files
COPY . .
# Build the React frontend
RUN cd web && npm run build
# Install FastAPI and Uvicorn for the backend
RUN pip install fastapi uvicorn
# Expose port 7860 (Hugging Face Spaces default)
EXPOSE 7860
# Start the FastAPI server
CMD ["python", "space_server.py"]