0

When I'm trying to install packages in requirements to the dir '/home/site/wwwroot' I'm getting the following error

/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

Here's is my 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

and My requirements.txt is

    azure-functions
pyodbc
pandas
numpy
azure-eventhub

how to resolve it? Thanks in advance

LinPy
  • 16,987
  • 4
  • 43
  • 57
saranraj kumar
  • 207
  • 1
  • 2
  • 10

1 Answers1

0

in your last stage no exists the location /home/site/wwwroot.

You must copy this folder from a previus stage somethig like this

 COPY --from=previus_stage /home/site/wwwroot /home/site/wwwroot

another thing, your env variables should be like this.

ENV AzureWebJobsScriptRoot=/home/site/wwwroot
ENV AzureFunctionsJobHost__Logging__Console__IsEnabled=true