40 lines
1.1 KiB
Docker
40 lines
1.1 KiB
Docker
# Stage 1: Build the React frontend
|
|
FROM node:18-slim AS builder
|
|
WORKDIR /app
|
|
COPY package.json ./
|
|
# Use --force to avoid issues with dependency versions
|
|
RUN npm install --force
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# Stage 2: Setup the production environment
|
|
FROM python:3.9-slim
|
|
WORKDIR /app
|
|
|
|
# Install Node.js
|
|
RUN apt-get update && apt-get install -y curl && \
|
|
curl -sL https://deb.nodesource.com/setup_18.x | bash - && \
|
|
apt-get install -y nodejs
|
|
|
|
# Copy built frontend from builder stage
|
|
COPY --from=builder /app/dist ./gtm-architect/dist
|
|
|
|
# Copy backend files and application code
|
|
COPY gtm-architect/server.cjs ./gtm-architect/
|
|
COPY gtm-architect/package.json ./gtm-architect/
|
|
COPY gtm_architect_orchestrator.py .
|
|
COPY helpers.py .
|
|
COPY config.py .
|
|
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 cd gtm-architect && npm install --production
|
|
|
|
# Expose the port the server will run on
|
|
EXPOSE 3005
|
|
|
|
# Command to run the server
|
|
CMD ["node", "gtm-architect/server.cjs"] |