heymenn's picture
initial commit
4b1a31e
raw
history blame contribute delete
922 Bytes
# Stage 1: Build Frontend
FROM node:20-alpine as build
WORKDIR /app
COPY package.json package-lock.json ./
# Install dependencies
RUN npm install
# Copy source code
COPY . .
# Build
RUN npm run build
# Stage 2: Run Backend
FROM python:3.10-slim
WORKDIR /app
# Install system dependencies
# RUN apt-get update && apt-get install -y gcc
# Install Python dependencies
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy Backend Code
# We copy contents of backend/ directly to /app so main.py is at /app/main.py
COPY backend /app
# Copy Built Frontend from Stage 1 to /app/static
COPY --from=build /app/dist /app/static
# Create cache directory for Hugging Face (optional, but good for permissions)
RUN mkdir -p /app/cache
ENV HF_HOME=/app/cache
# Expose port (HF Spaces uses 7860)
EXPOSE 7860
# Run Application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]