This commit is contained in:
parent
fe672b8f9c
commit
50a71d9600
21
.drone.yml
Normal file
21
.drone.yml
Normal 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
|
10
hanyadikhetvan/__init__.py
Normal file
10
hanyadikhetvan/__init__.py
Normal 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)
|
19
hanyadikhetvan/function.json
Normal file
19
hanyadikhetvan/function.json
Normal 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
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
azure-functions
|
Loading…
Reference in New Issue
Block a user