Npm global packages not installing on build

I’m trying to install eslint on a docker container, the Dockerfile is as follows:

FROM php:7.0

RUN apt-get update && apt-get install -y \
    curl \
    build-essential

RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g eslint

The build finishes without any errors but eslint doesn’t get installed, however if I go into the container using bash and run npm install -g eslint “manually” then it works just fine. Is there anything I’m doing wrong here?

your Dockerfile is correct and it works for me.
Try to rebuild it.

docker build --tag eslint .
docker run -ti eslint eslint

BTW: you also could derive from an node image. You do not need php for eslint?

Thanks, can’t believe I didn’t try building from scratch… :sweat_smile:

I’m running other php related stuff in that image as well so it’s easier to start from that, I just added the node related lines to help with readability.