zaach-jsonlint
SUCCESS
10m 14s
History Source
SummaryIterations1Transcript17Dockerfile
Dockerfile26 lines · 819 chars
FROM node:lts-bookworm

# Install dependencies and build jsonlint from source
WORKDIR /usr/src/app

# Install dependencies first
COPY package.json package-lock.json ./
RUN npm install

# Create required directories in case some environments lack them
RUN mkdir -p lib web

# Copy rest of the source
COPY . .

# Build step: generate lib/jsonlint.js and web/jsonlint.js
# The repository ships with prebuilt lib/jsonlint.js and web/jsonlint.js, but keep a build step for compatibility
RUN if [ -f src/jsonlint.y ] && [ -f src/jsonlint.l ]; then \
      ./node_modules/jison/lib/cli.js src/jsonlint.y src/jsonlint.l && \
      mv jsonlint.js lib/jsonlint.js && \
      node scripts/bundle.js | ./node_modules/uglify-js/bin/uglifyjs > web/jsonlint.js; \
    fi

# Default command: run jsonlint CLI
CMD ["node","lib/cli.js"]