I'm using Azure functions with GitHub deployment. I would like to place the function in src/server/functionName/
within the repo, but the deployment works only if the function is placed directly in functionName/
How do I deploy functions that are placed in subdirectories?
The documentation states
your host.json file and function folders should be directly at the root of what you deploy.
but "should" doesn't mean "must", right?
What I tried:
host.json
I set routePrefix
but it seems to affect only the function's URL: "http": { "routePrefix": "src/server" },
There are a few ways you can customize the deployment process. One way is by adding a custom deployment script to your repository root. When a .deployment
script exists Azure will run that script as part of the deployment process as detailed here. E.g. you can write a simple script that copies the files and directories from your sub directory \src\server
to the root, e.g.:
@echo off
echo Deploying Functions ...
xcopy "%DEPLOYMENT_SOURCE%\src\server" %DEPLOYMENT_TARGET% /Y /S
If you don't want to commit a .deployment
file to your repo and your requirements are relatively simple, you can also do this via app settings by adding a PROJECT
app setting to your function app with the value being your sub directory, e.g. src\server
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With