Skip to content

Commit

Permalink
Merge pull request #6 from pagopa/DEVOPS-1015-pago-pa-upgrade-runtime…
Browse files Browse the repository at this point in the history
…-azure-functions-in-the-gps-domain

Devops 1015 pago pa upgrade runtime azure functions in the gps domain
  • Loading branch information
pasqualespica authored May 19, 2023
2 parents 23f5c42 + 14c0149 commit 7b4a7cc
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 11 deletions.
9 changes: 3 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG JAVA_VERSION=11
# This image additionally contains function core tools – useful when using custom extensions
#FROM mcr.microsoft.com/azure-functions/java:3.0-java$JAVA_VERSION-core-tools AS installer-env
FROM mcr.microsoft.com/azure-functions/java:3.0-java$JAVA_VERSION-build AS installer-env
#FROM mcr.microsoft.com/azure-functions/java:4.0-java$JAVA_VERSION-core-tools AS installer-env
FROM mcr.microsoft.com/azure-functions/java:4.0-java$JAVA_VERSION-build AS installer-env

COPY . /src/java-function-app
RUN cd /src/java-function-app && \
Expand All @@ -11,10 +11,7 @@ RUN cd /src/java-function-app && \
cd $(ls -d */|head -n 1) && \
cp -a . /home/site/wwwroot

# This image is ssh enabled
#FROM mcr.microsoft.com/azure-functions/java:3.0-java$JAVA_VERSION-appservice
# This image isn't ssh enabled
FROM mcr.microsoft.com/azure-functions/java:3.0-java$JAVA_VERSION
FROM mcr.microsoft.com/azure-functions/java:4.0-java$JAVA_VERSION

ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ There is an example of a Http Trigger function.
---

## Run locally with Docker
`docker build -t pagopa-functions-template .`
`docker build -t pagopa-gpd-reporting-analysis .`

`docker run -p 8999:80 pagopa-functions-template`
`docker run -p 8999:80 pagopa-gpd-reporting-analysis`

### Test
`curl http://localhost:8999/example`
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
<appSettings>
<property>
<name>FUNCTIONS_EXTENSION_VERSION</name>
<value>~3</value>
<value>~4</value>
</property>
</appSettings>
<resourceGroup>java-functions-group</resourceGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/it/gov/pagopa/reporting/GetFlow.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import java.util.logging.Logger;

/**
* Azure Functions with Azure Queue trigger.
* Azure Functions with Azure Http trigger.
*/
public class GetFlow {

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/it/gov/pagopa/reporting/GetFlowList.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.logging.Logger;

/**
* Azure Functions with Azure Queue trigger.
* Azure Functions with Azure Http trigger.
*/
public class GetFlowList {

Expand Down
34 changes: 34 additions & 0 deletions src/main/java/it/gov/pagopa/reporting/Info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package it.gov.pagopa.reporting;

import com.microsoft.azure.functions.*;
import com.microsoft.azure.functions.annotation.AuthorizationLevel;
import com.microsoft.azure.functions.annotation.FunctionName;
import com.microsoft.azure.functions.annotation.HttpTrigger;

import java.util.Optional;
import java.util.logging.Level;


/**
* Azure Functions with Azure Http trigger.
*/
public class Info {

/**
* This function will be invoked when a Http Trigger occurs
* @return
*/
@FunctionName("Info")
public HttpResponseMessage run (
@HttpTrigger(name = "InfoTrigger",
methods = {HttpMethod.GET},
route = "info",
authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional<String>> request,
final ExecutionContext context) {

context.getLogger().log(Level.INFO, "Invoked health check HTTP trigger for pagopa-gpd-reporting-analysis.");
return request.createResponseBuilder(HttpStatus.OK)
.header("Content-Type", "application/json")
.build();
}
}

0 comments on commit 7b4a7cc

Please sign in to comment.