TheBrightFuture/Complete-Medical-Chatbot-with-LLMs-LangChain-Pinecone-FastAPI-React-with-authorization
0
1# Step 1: Build the Frontend (if it's React/Vite)2FROM node:22-slim AS frontend-builder3WORKDIR /frontend4COPY frontend/package*.json ./5RUN npm install6COPY frontend/ ./7RUN npm run build8 9# Step 2: Set up the Python Backend10FROM python:3.9-slim11WORKDIR /app12 13# Install backend dependencies14COPY backend/requirements.txt .15RUN pip install --no-cache-dir -r requirements.txt16 17# Copy backend code and the built frontend18COPY backend/ .19COPY --from=frontend-builder /frontend/dist ./static20 21# EXTREMELY IMPORTANT: Hugging Face uses port 786022ENV PORT=786023EXPOSE 786024 25# Start the FastAPI/Flask app26CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]27 28FROM python:3.9-slim29 30# Install Nginx and Node.js for the frontend31RUN apt-get update && apt-get install -y nginx nodejs npm supervisor32 33WORKDIR /app34 35# 1. Setup Backend36COPY backend/requirements.txt ./backend/37RUN pip install --no-cache-dir -r backend/requirements.txt38COPY backend/ ./backend/39 40# 2. Setup Frontend41COPY frontend/package*.json ./frontend/42RUN npm install -g npm@latest43RUN cd frontend && npm install44COPY frontend/ ./frontend/45# If you need to build the frontend first:46# RUN cd frontend && npm run build 47 48# 3. Copy Nginx Config49COPY nginx.conf /etc/nginx/nginx.conf50 51# 4. Use a script to start everything52COPY start.sh .53RUN chmod +x start.sh54 55EXPOSE 786056CMD ["./start.sh"]