当我试图将包安装到目录'/home/site/wwwroot‘中时,我得到了以下错误
/bin/sh: 1: cd: can't cd to /home/site/wwwroot
The command '/bin/sh -c cd /home/site/wwwroot && pip install -r requirements.txt' returned a non-zero code: 2
这是我的dockerfile
FROM mcr.microsoft.com/azure-functions/python:2.0
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
COPY . /home/site/wwwroot
FROM ubuntu
# ...
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get -y install gcc mono-mcs && \
rm -rf /var/lib/apt/lists/*
RUN cd /home/site/wwwroot && pip install -r requirements.txt
我的requirements.txt是
azure-functions
pyodbc
pandas
numpy
azure-eventhub
如何解决?提前感谢
发布于 2019-08-19 23:00:41
在您的最后一个阶段中,不存在位置/home/site/wwwroot
。
您必须从上一阶段复制此文件夹,如下所示
COPY --from=previus_stage /home/site/wwwroot /home/site/wwwroot
另外,你的环境变量应该是这样的。
ENV AzureWebJobsScriptRoot=/home/site/wwwroot
ENV AzureFunctionsJobHost__Logging__Console__IsEnabled=true
https://stackoverflow.com/questions/57554247
复制相似问题