Azure Functions as Docker Image : Cant find files

661 views Asked by At

So I am not sure how to explain this. I am running Azure Functions as Docker Images (c#) I have some files that when running the Azure function in Visual Studio get copied to the bin directory and the compiled code picks them up fine. (non-docker)

When I create the Docker Image and fire it up, again the files are where I think they should be (I went into the Docker Snapshot /home/site/wwwroot/bin/)

However, the Azure function root directory is Content root path: / (Environment.CurrentDirectory) which I have no idea where it is.

I did a function to list all the files in / and it was a .dockerenv file.

I hardcoded paths in my Azure function to the files I wanted /home/site/wwwroot/ etc and the library I am using sh*ts a brick

DockerFile

FROM microsoft/dotnet:2.2-sdk AS installer-env

COPY . /src/dotnet-function-app
RUN cd /src/dotnet-function-app && \
    mkdir -p /home/site/wwwroot && \
    dotnet publish *.csproj --output /home/site/wwwroot

# To enable ssh & remote debugging on app service change the base image to the one below
# FROM mcr.microsoft.com/azure-functions/dotnet:2.0-appservice 
FROM mcr.microsoft.com/azure-functions/dotnet:2.0
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true

COPY --from=installer-env ["/home/site/wwwroot", "/home/site/wwwroot"]

ADD aiml /home/site/wwwroot/bin/aiml
ADD config /home/site/wwwroot/bin/config

I follow this tutorial https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-function-linux-custom-image?tabs=bash%2Cportal&pivots=programming-language-csharp

By default where on a container is the root dir that has this .dockerenv file in?

0

There are 0 answers