add minimum files
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Torma Kristóf 2022-05-17 22:57:06 +02:00
parent fe672b8f9c
commit 50a71d9600
4 changed files with 51 additions and 0 deletions

21
.drone.yml Normal file
View File

@ -0,0 +1,21 @@
kind: pipeline
type: docker
name: Azure Function App
steps:
- name: Build and upload function app
environment:
AZURE_SP:
from_secret: AZURE_SP
AZURE_SP_PASSWORD:
from_secret: AZURE_SP_PASSWORD
AZURE_SP_TENANT:
from_secret: AZURE_SP_TENANT
FUNCTION_APP_NAME:
from_secret: FUNCTION_APP_NAME
image: mcr.microsoft.com/azure-cli
commands:
- apk add npm
- npm i -g azure-functions-core-tools@3 --unsafe-perm true
- az login --service-principal -u $AZURE_SP -p $AZURE_SP_PASSWORD --tenant $AZURE_SP_TENANT
- func azure functionapp publish $FUNCTION_APP_NAME --python

View File

@ -0,0 +1,10 @@
import logging
from datetime import date
import azure.functions as func
def main(req: func.HttpRequest) -> func.HttpResponse:
startdate = date(2022, 2, 6)
return func.HttpResponse(
(date.today() - startdate).days / 7,
status_code=200)

View File

@ -0,0 +1,19 @@
{
"scriptFile": "__init__.py",
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get"
]
},
{
"type": "http",
"direction": "out",
"name": "$return"
}
]
}

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
azure-functions