Skip to content

TypeError: Cannot read property 'reduce' of null #156

@AmauryOrtega

Description

@AmauryOrtega

When using this Dockerfile with the latest dockerfilelint docker image, an internal error shows up. I checked using /bin/sh to make sure the Dockerfile is accessible, I tried moving the Dockerfile to the working directory of /dockerfilelint/ and using the binary inside /dockerfilelint/bin/ but I got the same error message.

Dockerfile

FROM node:12-alpine as dependencies

# Source directory
WORKDIR /usr/src/app/
RUN chown -R node:node .
USER node

# Dependencies
COPY --chown=node:node package*.json ./
RUN npm ci

# Source code and build configuration
COPY --chown=node:node angular.json tsconfig*.json ./
COPY --chown=node:node ngsw-config.json .
COPY --chown=node:node src/ src/

# Compilation
FROM dependencies as build
RUN npx ng build --prod

FROM nginx:stable-alpine
# hadolint ignore=DL3018
RUN apk --no-cache add curl \
   && rm -rf /var/cache/apk/*
HEALTHCHECK CMD curl -f http://localhost/ || exit 1

COPY --chown=nginx:nginx --from=build /usr/src/app/dist/bouwmapp-frontend/ /usr/share/nginx/app/
COPY --chown=nginx:nginx nginx/app.conf /etc/nginx/conf.d/default.conf
EXPOSE 80

Command

docker run --rm -v "$PWD"/Dockerfile:/Dockerfile:ro replicated/dockerfilelint:latest /Dockerfile

Output

/dockerfilelint/lib/checks.js:194
      if (!options.reduce((valid, item) => valid &&
                   ^
TypeError: Cannot read property 'reduce' of null
    at Object.is_valid_healthcheck (/dockerfilelint/lib/checks.js:194:20)
    at runLine (/dockerfilelint/lib/index.js:287:16)
    at Object.module.exports.run (/dockerfilelint/lib/index.js:63:18)
    at processContent (/dockerfilelint/bin/dockerfilelint:92:50)
    at argv._.forEach (/dockerfilelint/bin/dockerfilelint:86:3)
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/dockerfilelint/bin/dockerfilelint:65:8)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions