'docker nestjs could not build

FROM node:latest as development
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install --only=development
COPY . .
RUN npm run build


FROM node:latest as production
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install --only=production
COPY . .
COPY --from=development /usr/src/app/prisma ./prisma
COPY --from=development /usr/src/app/dist ./dist
EXPOSE 3000
CMD npm run start:prod

Since I'm using a Mac m1 chip computer, I use the following command to build.

sudo docker buildx build --platform=linux/amd64  -t swai-api . 

But it was never built. It gives the following error.

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source