Docker Community Forums

Share and learn in the Docker community.

Php-fpm-alpine3.14 breaks browserslist install

I’ve been looking at the php8.0.8 upgrade which was released earlier this month.

It looks like something’s broken in the alpine3.14 branch which was previously working on alpine3.13.

To demonstrate, the following basic Dockerfile works:

FROM php:8.0.8-fpm-alpine3.13
COPY package.json ./
COPY yarn.lock ./
RUN apk add --no-cache --update nodejs npm yarn
RUN npx browserslist@latest --update-db

But the following doesn’t:

FROM php:8.0.8-fpm-alpine3.14
COPY package.json ./
COPY yarn.lock ./
RUN apk add --no-cache --update nodejs npm yarn
RUN npx browserslist@latest --update-db

It breaks with:

Step 10/10 : RUN npx browserslist@latest --update-db
 ---> Running in 27a8911c6250
npm WARN exec The following package was not found and will be installed: browserslist@latest
sh: browserslist: Permission denied

For reference, the package.json is simply {}.

Running the same against the raw alpine3.14 image it works fine too:

FROM alpine:3.14
COPY package.json ./
COPY yarn.lock ./
RUN apk add --no-cache --update nodejs npm yarn
RUN npx browserslist@latest --update-db

So it looks like something within the PHP build. The Dockerhub page says to report it in the forums, so here it is. Can anyone assist?

My docker version is Docker version 20.10.6, build 370c289, should that matter.

Jonathan.

The first and second Dockerfiles are the same. Is there any difference between the one that works and one that doesn’t?

hey @petk - I was a muppet in my copy/paste from my test environment.

I’ve updated the ticket. The one with php:8.0.8-fpm-alpine3.13 works, but with php:8.0.8-fpm-alpine3.14 doesn’t.

using the base apline3.14 works fine (not the PHP-derived image. Apologies for the confusion.

Try adding a WORKDIR directive:

WORKDIR /home/node/app

you are copying files to the root directory which isn’t such a good practice. It’s full of those /etc and system folders.

Agreed, the description is unclear about for what type of help which link should be used.

You can find the Github link in the Quick reference (cont.) section:

As this clearly looks like a defect of the image, I would suggest to raise an issue in the github project.