Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I remove `RUN apk add --no-cache python2 g++ make` from my Dockerfile?

In the docker tutorial I'm following it tells me to put the following commands in my Dockerfile:

# syntax=docker/dockerfile:1
FROM node:12-alpine
RUN apk add --no-cache python2 g++ make
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "src/index.js"]

I understand what all of the lines are doing, except for:

RUN apk add --no-cache python2 g++ make

And everything seems to work without it. Can I delete this line from my Dockerfile? Will deleting this line cause problems for me down the road? Why do I need anything "python" in this node project?

like image 603
Luke Schlangen Avatar asked Oct 23 '25 16:10

Luke Schlangen


1 Answers

Reading the PR which added that line, it seems like it was added to fix an issue with Apple M1 support for the node-gyp package. A later PR took the line back out, but that change does not seem to be reflected on the docker website.

That does beg the question of why it breaks on M1, but I don't have an M1 laptop, so I can't answer that.

like image 122
Nick ODell Avatar answered Oct 26 '25 06:10

Nick ODell