Spaces:
Build error
Build error
Download Dockerfile from srinuksv/fastapi-react: direct link, hf CLI and curl.
- Browser
- Download file 574 Bytes
-
https://huggingface.co/spaces/srinuksv/fastapi-react/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/srinuksv/fastapi-react/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/srinuksv/fastapi-react/resolve/main/Dockerfile
574 Bytes
| # Stage 1: Build the React app | |
| FROM node:18 AS build | |
| WORKDIR /app/frontend | |
| COPY frontend/package.json ./ | |
| RUN npm install | |
| COPY frontend/src ./src | |
| RUN npm run build | |
| # Stage 2: Set up FastAPI | |
| FROM python:3.12-slim | |
| WORKDIR /app | |
| # Install FastAPI and Uvicorn | |
| COPY app/requirements.txt ./ | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the built React app from the previous stage | |
| COPY --from=build /app/frontend/build ./frontend/build | |
| COPY app/main.py ./app/ | |
| # Command to run the FastAPI app | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] | |