Merge pull request #2 from valueonag/feat/deploy

chore: prepare deployment
This commit is contained in:
Christopher Gondek 2025-10-15 10:35:29 +02:00 committed by GitHub
commit 187127458e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 115 additions and 70 deletions

View file

@ -1,76 +1,70 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions
name: Build and deploy Python app to Azure Web App - poweron-preprocessing
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read #This is required for actions/checkout
steps:
- uses: actions/checkout@v4
- name: Set up Python version
uses: actions/setup-python@v5
with:
python-version: '3.13'
# 🛠️ Local Build Section (Optional)
# The following section in your workflow is designed to catch build issues early on the client side, before deployment. This can be helpful for debugging and validation. However, if this step significantly increases deployment time and early detection is not critical for your workflow, you may remove this section to streamline the deployment process.
- name: Create and Start virtual environment and Install dependencies
run: |
python -m venv antenv
source antenv/bin/activate
pip install -r requirements.txt
# By default, when you enable GitHub CI/CD integration through the Azure portal, the platform automatically sets the SCM_DO_BUILD_DURING_DEPLOYMENT application setting to true. This triggers the use of Oryx, a build engine that handles application compilation and dependency installation (e.g., pip install) directly on the platform during deployment. Hence, we exclude the antenv virtual environment directory from the deployment artifact to reduce the payload size.
- name: Upload artifact for deployment jobs
uses: actions/upload-artifact@v4
with:
name: python-app
path: |
.
!antenv/
# 🚫 Opting Out of Oryx Build
# If you prefer to disable the Oryx build process during deployment, follow these steps:
# 1. Remove the SCM_DO_BUILD_DURING_DEPLOYMENT app setting from your Azure App Service Environment variables.
# 2. Refer to sample workflows for alternative deployment strategies: https://github.com/Azure/actions-workflow-samples/tree/master/AppService
deploy:
runs-on: ubuntu-latest
needs: build
name: Build and deploy Python app to Azure Web App - poweron-preprocessing
on:
push:
branches: [main]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write #This is required for requesting the JWT
contents: read #This is required for actions/checkout
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: python-app
- name: Login to Azure
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
# ---------- BACKEND / PYTHON ----------
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v6
# ---------- ARTIFACT ----------
- name: Upload artifact for deployment jobs
uses: actions/upload-artifact@v4
with:
name: python-app
path: |
.
!venv/
!.venv/
!.git/
!.cache/
deploy:
runs-on: ubuntu-latest
needs: build
permissions:
id-token: write # <-- required for OIDC
contents: read
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: python-app
- name: Login to Azure (OIDC)
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_AA4B9998A69E4C5C8FDF357E3FEAADD5 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_CC57AD1F29D44DDA960AE3EAC6D2C27A }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_4CD1D97C506D403E8E284466DB4E7898 }}
- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy@v3
id: deploy-to-webapp
with:
app-name: 'poweron-preprocessing'
slot-name: 'Production'
# Runtime env files (required in your setup)
- name: Set productive environment (runtime)
run: |
set -euo pipefail
cp env_prod.env .env
- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v3
with:
app-name: "poweron-preprocessing"
slot-name: "Production"
package: . # reuse the downloaded artifact folder
# no publish-profile here; it will use the az login from azure/login

8
env_prod.env Normal file
View file

@ -0,0 +1,8 @@
PP_CONFIG_PATH="/Users/christopher/Documents/Repos/vo-customer-preprocessor/src/pp-config.yaml"
PP_API_KEY="kj823u90209mj020394jp2msakhfkjashjkf"
DB_ENDPOINT_API_KEY="ouho02j0rj2oijroi3rj2oijro23jr0990"
DB_URL="/Users/christopher/Documents/Repos/vo-customer-preprocessor/data/data_althaus.db"
POWERBI_DATASET_ID="0e72b1f1-3d32-4caa-bc1a-e523b6232343"
POWERBI_CLIENT_ID="9f6fa2cf-3fe1-4ed5-a430-bb7e408c0d87"
POWERBI_CLIENT_SECRET="Vdy8Q~Bm2_5ooy-pgYtEgvA9-LjRN2HiXFw6Ody0"
POWERBI_TENANT_ID="6a51aaeb-2467-4186-9504-2a05aedc591f"

42
requirements.txt Normal file
View file

@ -0,0 +1,42 @@
aiosqlite==0.21.0
annotated-types==0.7.0
anyio==4.11.0
certifi==2025.8.3
cffi==2.0.0
charset-normalizer==3.4.3
click==8.3.0
cryptography==46.0.1
fastapi==0.117.1
greenlet==3.2.4
h11==0.16.0
httpcore==1.0.9
httpx==0.28.1
idna==3.10
iniconfig==2.1.0
msal==1.34.0
numpy==2.3.3
packaging==25.0
pandas==2.3.2
pluggy==1.6.0
pycparser==2.23
pydantic==2.11.9
pydantic-core==2.33.2
pydantic-settings==2.10.1
pygments==2.19.2
pyjwt==2.10.1
pytest==8.4.2
pytest-asyncio==1.2.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.1
pytz==2025.2
pyyaml==6.0.2
requests==2.32.5
six==1.17.0
sniffio==1.3.1
sqlalchemy==2.0.43
starlette==0.48.0
typing-extensions==4.15.0
typing-inspection==0.4.1
tzdata==2025.2
urllib3==2.5.0
uvicorn==0.37.0

1
startup.txt Normal file
View file

@ -0,0 +1 @@
uvicorn app:app --host 0.0.0.0 --port 8000