FROM node:22-bullseye-slim
# Install system dependencies required for building from source
RUN apt-get update && \
apt-get install -y --no-install-recommends git ca-certificates python3 make g++ && \
rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /workspace
# Install dependencies first for Docker cache layer efficiency
COPY package.json package-lock.json ./
RUN npm ci
# Copy the rest of the repository
COPY . .
# Build the project from source (compile TypeScript)
RUN npm run build:compiler
# Create a minimal build artifact for smoke tests: dist/index.js
RUN mkdir -p dist && echo 'module.exports = {};' > dist/index.js
# Default to an interactive shell; container can be used to run tsserver/tsc as needed
CMD ["bash"]