FROM node:16-bullseye-slim
# Install build tools required for building from source
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential python3 && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy manifest files first for efficient caching
COPY package.json package-lock.json ./
RUN npm install
# Copy rest of the repository
COPY . .
# Build the project from source (generate lib/jsonlint.js and web/jsonlint.js)
RUN make build
# Default to running the jsonlint CLI
ENTRYPOINT ["node", "lib/cli.js"]