[30388f42] Recovery & Stabilization: Restored productive core stack, implemented Docker Volumes for DB persistence, and fixed frontend build issues.

This commit is contained in:
2026-03-07 08:06:50 +00:00
parent 193b7b0e7d
commit efcaa57cf0
10 changed files with 610 additions and 225 deletions

View File

@@ -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"]

View File

@@ -22,10 +22,7 @@
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.16",
"postcss": "^8.4.32",
"tailwindcss": "^3.3.6",
"typescript": "^5.3.3",
"vite": "^5.0.8"
"vite": "^5.0.10"
}
}

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"allowImportingTsExtensions": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}

View File

@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}