Hi @Takahito Iwasa ,
Thank you for your answer. Let me give you some more detail - probably I did not explain myself clear enough.
I am trying to replicate the example that is in "Quickstart: Create a Go or Rust function". I set up a couple of methods that respond to REST requests, and I bundeled them as well as a Jetty server, that manages and routes the requests, into the JAR. When I run java -jar handler.jar
, an instance of a Jetty server is started, so I can navigate to http://localhost:8080/ping
. I can achieve the same when using func start
with the following host.json
:
"customHandler": {
"description": {
"defaultExecutablePath": "java",
"arguments": ["-jar", "handler.jar"]
},
"enableForwardingHttpRequest": true
}
So func
will start a functions host that will redirect all its HTTP requests to the my server. This solution uses the JRE I have installed on my computer.
Now, I would like to deploy this app to Azure Functions. One possible way would be to create a custom image with the following Dockerfile:
FROM mcr.microsoft.com/azure-functions/java:4-java11-slim
ENV AzureWebJobsScriptRoot=/home/site/wwwroot
COPY ["./functions", "/home/site/wwwroot"]
and start a function by using this image - I tried this and it works ok. I was just wondering, if there is a way to avoid this step? For example, push only the JAR and all the .json
files to functions and use the default JRE, that is included when I create a Function App with the Java runtime stack, in a similar way as func start
?
Thank you!