- Refactors the gtm-architect Dockerfile for a flat, more efficient build process. - Implements robust web scraping via BeautifulSoup in helpers.py for URL analysis in phase1. - Makes shared library imports (gspread, pandas, etc.) in helpers.py optional to prevent ModuleNotFoundErrors in microservices. - Implements the main execution logic in the orchestrator to handle command-line arguments. - Updates documentation to reflect the new architecture, scraping feature, and dependency handling.
50 lines
1.3 KiB
Docker
50 lines
1.3 KiB
Docker
# Stage 1: Build the React frontend
|
|
FROM node:20-slim AS builder
|
|
WORKDIR /app
|
|
|
|
# Copy package.json from the subdirectory (relative to project root)
|
|
COPY gtm-architect/package.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm install --force
|
|
|
|
# Copy the rest of the frontend source code
|
|
COPY gtm-architect/ ./
|
|
|
|
# Build the frontend
|
|
RUN npm run build
|
|
|
|
# Stage 2: Setup the production environment
|
|
FROM python:3.11-slim
|
|
WORKDIR /app
|
|
|
|
# Install Node.js
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends curl ca-certificates && \
|
|
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
|
apt-get install -y --no-install-recommends nodejs && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy built frontend from builder stage
|
|
COPY --from=builder /app/dist ./dist
|
|
|
|
# Copy backend files and application code (paths relative to project root)
|
|
COPY gtm-architect/server.cjs .
|
|
COPY gtm-architect/package.json .
|
|
COPY gtm_architect_orchestrator.py .
|
|
COPY helpers.py .
|
|
COPY config.py .
|
|
# Use the specific requirements file for this app
|
|
COPY gtm-architect/requirements.txt .
|
|
COPY gtm_db_manager.py .
|
|
|
|
# Install Python and Node.js dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
RUN npm install --omit=dev
|
|
|
|
# Expose the port the server will run on
|
|
EXPOSE 3005
|
|
|
|
# Command to run the server
|
|
CMD ["node", "server.cjs"]
|