FROM node:lts-trixie
# Install system dependencies
RUN set -eux; \
apt-get update -y; \
apt-get install -y --no-install-recommends ca-certificates curl git python3 build-essential; \
rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Copy package.json and package-lock.json first to leverage Docker cache
COPY package.json package-lock.json ./
# Install dependencies without running postinstall scripts to avoid environment-specific issues
RUN npm ci --ignore-scripts
# Copy the rest of the source code
COPY . .
# Build the chat-lib first if it exists inputs (skip if not present to accommodate monorepo layout)
RUN if [ -d chat-lib/src ]; then \
cd chat-lib && npm ci --ignore-scripts && npm run build && cd ..; \
else \
echo "Skipping chat-lib build (no chat-lib/src)"; \
fi
# Build the root project
RUN npm run build
# Default to a shell to keep the container interactive after build
CMD ["/bin/bash"]