FROM node:20-slim
# Install system dependencies needed for native modules
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Yarn (legacy v1) via npm with force to avoid conflicts
RUN npm install -g yarn@1.22.22 --force
# Disable husky git hooks for non-interactive builds
ENV SKIP_HUSKY=1
WORKDIR /work
# Copy package descriptors first to leverage build cache
COPY package.json yarn.lock ./
# Install dependencies with frozen lockfile
RUN yarn install --frozen-lockfile
# Copy the rest of the source
COPY . .
# Attempt to build workspaces if a build script exists; ignore if not present
RUN yarn workspaces run build || true
# Default command: run webpack CLI help (if available)
CMD ["node","bin/webpack.js","--help"]