semantic-analyzer / Dockerfile
Dwarakesh-V's picture
Update Dockerfile
23ad201
# --------------------------
# 1. FRONTEND BUILD STAGE
# --------------------------
FROM node:18 AS frontend-builder
WORKDIR /app
# Copy package manifests from repo root
COPY package.json package-lock.json ./
# Install dependencies
RUN npm install
# Copy full repo (needed for Vite config + frontend/src + public)
COPY . .
# Build the Vite frontend (outputs to /app/frontend/dist)
RUN npm run build
# --------------------------
# 2. PYTHON BACKEND STAGE
# --------------------------
FROM python:3.10
WORKDIR /app
# Backend code
COPY backend/ ./backend/
# Python engine
COPY python_engine/ ./python_engine/
# Tree data
COPY tree_data/ ./tree_data/
# Copy Vite public folder (needed for /static mount)
RUN mkdir -p frontend/public
COPY frontend/public ./frontend/public
# Copy Vite build output
RUN mkdir -p frontend/dist
COPY --from=frontend-builder /app/frontend/dist ./frontend/dist
# Install Python dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# NLTK needs tokenizer data
RUN python -m nltk.downloader punkt
RUN python -m nltk.downloader punkt_tab
ENV PORT=7860
EXPOSE 7860
CMD ["python", "-m", "uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "7860"]