Spaces:
Sleeping
Sleeping
| # Build Stage for React Frontend | |
| FROM node:18-alpine as build | |
| WORKDIR /app/frontend | |
| COPY frontend/package*.json ./ | |
| # Use strict helper to avoid hanging on optional deps | |
| RUN npm install --include=dev | |
| COPY frontend/ . | |
| RUN npm run build | |
| # Runtime Stage | |
| FROM python:3.10-slim | |
| # Set up user properly for HF Spaces (user 1000) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| # -- Environment Configuration -- | |
| # DEMO_MODE=true uses simulated MST-aware responses (no model loading required) | |
| # For production/GPU, set DEMO_MODE=false to load actual MedGemma model | |
| ENV DEMO_MODE="false" | |
| ENV LOCAL_MODEL_PATH="NurseCitizenDeveloper/ewaast-medgemma-1.5-4b" | |
| ENV USE_LOCAL_MODEL="true" | |
| ENV FLASK_ENV="production" | |
| ENV PORT=7860 | |
| # Copy requirements and install Python deps | |
| COPY --chown=user requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Copy Flask App code | |
| COPY --chown=user . . | |
| # Copy built React assets from Stage 1 | |
| # ewaast_app.py uses frontend/build as static folder, so copy entire build there | |
| COPY --chown=user --from=build /app/frontend/build ./frontend/build | |
| # Copy public/assets folder (patient data JSON, patient images) into the build folder | |
| COPY --chown=user frontend/public/assets ./frontend/build/assets | |
| # Expose port (HF Spaces uses 7860) | |
| EXPOSE 7860 | |
| # Start the Flask app (ewaast_app.py has the stream_assessment endpoint) | |
| CMD ["python", "ewaast_app.py"] | |