[30388f42] Recovery & Stabilization: Restored productive core stack, implemented Docker Volumes for DB persistence, and fixed frontend build issues.
This commit is contained in:
@@ -1,29 +1,51 @@
|
||||
# --- STAGE 1: Build Frontend ---
|
||||
# This stage uses a more robust, standard pattern for building Node.js apps.
|
||||
# It creates a dedicated 'frontend' directory inside the container to avoid potential
|
||||
# file conflicts in the root directory.
|
||||
FROM node:20-slim AS frontend-builder
|
||||
WORKDIR /build
|
||||
COPY frontend/package*.json ./
|
||||
RUN npm install
|
||||
COPY frontend/ ./
|
||||
RUN grep "ROBOTICS EDITION" src/App.tsx || echo "Version string not found in App.tsx"
|
||||
WORKDIR /app
|
||||
# Copy the entire frontend project into a 'frontend' subdirectory
|
||||
COPY frontend ./frontend
|
||||
# Set the working directory to the new subdirectory
|
||||
WORKDIR /app/frontend
|
||||
# Install dependencies and build the project from within its own directory
|
||||
RUN npm install --no-audit --no-fund
|
||||
RUN npm run build
|
||||
|
||||
# --- STAGE 2: Backend & Runtime ---
|
||||
# --- STAGE 2: Backend Builder ---
|
||||
FROM python:3.11-slim AS backend-builder
|
||||
WORKDIR /app
|
||||
|
||||
# Install only the bare essentials for building Python wheels
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends build-essential gcc && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY requirements.txt .
|
||||
# Install to /install to easily copy to final stage
|
||||
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
|
||||
|
||||
# --- STAGE 3: Final Runtime ---
|
||||
FROM python:3.11-slim
|
||||
WORKDIR /app
|
||||
|
||||
# System Dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
# Set non-interactive to avoid prompts
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Copy Requirements & Install
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
# Minimal runtime system dependencies (if any are ever needed)
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends curl && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# Copy Built Frontend from Stage 1 (To a safe location outside /app)
|
||||
COPY --from=frontend-builder /build/dist /frontend_static
|
||||
# Copy only the installed Python packages
|
||||
COPY --from=backend-builder /install /usr/local
|
||||
ENV PATH=/usr/local/bin:$PATH
|
||||
|
||||
# Copy Backend Source
|
||||
# Copy Built Frontend from the new, correct location
|
||||
COPY --from=frontend-builder /app/frontend/dist /frontend_static
|
||||
|
||||
# Copy only necessary Backend Source
|
||||
COPY backend ./backend
|
||||
|
||||
# Environment Variables
|
||||
@@ -33,5 +55,5 @@ ENV PYTHONUNBUFFERED=1
|
||||
# Expose Port
|
||||
EXPOSE 8000
|
||||
|
||||
# Start FastAPI
|
||||
CMD ["uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
||||
# Start FastAPI (Production mode without --reload)
|
||||
CMD ["uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
|
||||
Reference in New Issue
Block a user