Sha*_*Sha 6 node.js docker apple-m1
怎么了?我应该等待生产泊坞窗吗?
这是泊坞窗配置:
# 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
Run Code Online (Sandbox Code Playgroud)
小智 10
尝试使用 linux/amd64 运行它。
在您的 docker 配置更改中:
FROM node:lts-alpine as build-stage
到
FROM --platform=linux/amd64 node:lts-alpine as build-stage
您需要安装 python 作为构建过程的一部分。有关如何安装 python 的更多详细信息,请查看此处
# build stage
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY ./ .
RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python
RUN python3 -m ensurepip
RUN pip3 install --no-cache --upgrade pip setuptools
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
RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python
RUN python3 -m ensurepip
RUN pip3 install --no-cache --upgrade pip setuptools
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11485 次 |
| 最近记录: |