我能够在Google Cloud Run上成功部署我的代码和映像。但在Azure容器应用上部署时,相同的设置导致错误。请建议可能的原因以及如何修复它?我正在执行命令:
az containerapp up
以下是我收到的错误:
The command failed with an unexpected error. Here is the traceback:
[WinError 3] The system cannot find the path specified: './node_modules\\@babel\\plugin-proposal-nullish-coalescing-operator\\node_modules\\@babel\\helper-function-name\\node_modules\\@babel\\types\\lib\\builders\\flow\\createTypeAnnotationBasedOnTypeof.js'
以下是我的dockerfile内容:
FROM node:16-alpine as build-step
WORKDIR app/
# ENV PATH /app/node_modules/.bin:$PATH
# COPY package.json yarn.lock ./
# COPY package.json yarn.lock tsconfig.json ./
# COPY src/ ./src
# COPY public/ ./public
COPY . ./
RUN yarn
RUN yarn build
# Build step #2: build the API with the client as static files
FROM python:3.11.2-bullseye
# Allow statements and log messages to immediately appear in the Knative logs
ENV PYTHONUNBUFFERED True
WORKDIR app/
COPY --from=build-step app/build ./build
RUN mkdir ./api
COPY api/ ./api
RUN pip3 install -U pip && pip3 install --no-cache-dir -r ./api/requirements.txt
ENV QUART_ENV $QUART_ENV
# EXPOSE $PORT
WORKDIR /app/api
# CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:flask_app
CMD exec hypercorn --bind :$PORT main:quart_app
以下是我的package.json依赖项:
"dependencies": {
"@date-io/moment": "^2.15.0",
"@emotion/react": "^11.7.1",
"@emotion/styled": "^11.6.0",
"@formkit/auto-animate": "^1.0.0-beta.6",
"@lottiefiles/react-lottie-player": "^3.4.9",
"@mui/core": "^5.0.0-alpha.54",
"@mui/icons-material": "^5.2.5",
"@mui/material": "^5.4.0",
"@mui/x-date-pickers": "^5.0.0-beta.5",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.19",
"@types/superagent": "^4.1.15",
"@types/underscore": "^1.11.4",
"firebase": "^9.9.0",
"js-cookie": "^3.0.1",
"moment": "^2.29.4",
"query-string": "^7.1.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-firebase-hooks": "^5.0.3",
"react-ga4": "^1.4.1",
"react-hook-form": "^7.25.3",
"react-iframe": "^1.8.5",
"react-router-dom": "^6.2.1",
"react-scripts": "5.0.0",
"typescript": "^4.7.4",
"underscore": "^1.13.2",
"universalify": "^2.0.0",
"web-vitals": "^2.1.3"
},
"devDependencies": {
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.2"
}
1条答案
按热度按时间bmp9r5qi1#
将
**/node_modules/
添加到您的.dockerignore
文件中。(如果您没有存储库,请在存储库的根目录下创建一个)您遇到了Windows
MAXPATH
问题,请参阅此以了解更多详细信息:https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation如果您的系统〉= Windows 10,Version 1607,您也可以尝试启用长路径。请参阅https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later