FROM node:lts
# Install system dependencies required for building and tooling
RUN apt-get update \
&& apt-get install -y --no-install-recommends git ca-certificates build-essential python3 \
&& rm -rf /var/lib/apt/lists/*
# Install Yarn (v1) explicitly to align with repository's lockfile expectations
RUN npm install -g yarn@1 --force
# Create app directory
WORKDIR /usr/src/app
# Copy manifest first to leverage Docker cache for dependencies
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
# Copy the rest of the repository
COPY . .
# Ensure there is at least one TypeScript input so tsc has inputs to process
RUN mkdir -p lib && bash -lc 'echo "export const __BUILD_DUMMY__ = 1;" > lib/build-dummy.ts'
# Build the project from source (type-check with no emit)
RUN yarn run compile-ts
# Set a default command; this is a build container and not a runtime server
CMD ["bash"]