What’s wrong? I should wait for the production docker?
This is docker config:
# build stage
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY ./ .
RUN npm run build
# production stage
FROM nginx:stable-alpine as production-stage
RUN mkdir /app
COPY --from=build-stage /app/dist /app
COPY nginx.conf /etc/nginx/nginx.conf
6
Answers
You need to install python as part of your build process. For more details how to install python check here
You need python with
make
andg++
to build your dependencies.Well, you need python. And the already provided answers here will provide you with that and the minimalist might be looking for something like that.
Another option would be not to use the alpine version of node (which comes for good reasons with a minimized footprint). I’ve personally accepted the overhead of a bigger image in favor of saving time by not installing python. So my (potentially opinionated) solution would be to just replace
with
Try running it with linux/amd64.
In your docker config change:
FROM node:lts-alpine as build-stage
to
FROM --platform=linux/amd64 node:lts-alpine as build-stage
For me this only worked
Changing
to
For me the solution of Y H helps to add
--platform=linux/amd64
in theFROM
statement.But if you don’t want to change your
Dockerfile
, you can also setDOCKER_DEFAULT_PLATFORM
before building the docker image:export DOCKER_DEFAULT_PLATFORM=linux/amd64