ci: dockerise l'API + connexion DB et CORS configurables par env

- config.py: connexion SQL via DB_* (driver 18, auth SQL), fallback Windows local
- main.py: origines CORS via CORS_ORIGINS
- Dockerfile (python 3.12 + msodbcsql18) + workflow Gitea Actions (build/push image)
This commit is contained in:
neckfire
2026-06-20 12:21:47 +02:00
parent e0b314ee76
commit 51d041c0da
4 changed files with 97 additions and 7 deletions
+37
View File
@@ -0,0 +1,37 @@
name: Build & Deploy
on:
push:
branches: [main]
workflow_dispatch: {}
env:
IMAGE: git.nfteam.ovh/neckfire/datasentinel-api
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build & push image
run: |
set -e
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.nfteam.ovh -u "${{ secrets.REGISTRY_USER }}" --password-stdin
docker build -t "${IMAGE}:latest" -t "${IMAGE}:${GITHUB_SHA::12}" .
docker push --all-tags "${IMAGE}"
echo "pushed ${IMAGE}"
- name: Notify ntfy (success/failure)
if: always()
run: |
if [ "${{ job.status }}" = "success" ]; then EMOJI="white_check_mark"; PRIO="default"; else EMOJI="rotating_light"; PRIO="high"; fi
curl -s \
-H "Authorization: Bearer ${{ secrets.NTFY_TOKEN }}" \
-H "Title: ${GITHUB_REPOSITORY} — ${{ job.status }}" \
-H "Priority: ${PRIO}" \
-H "Tags: ${EMOJI}" \
-H "Click: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions" \
-d "${GITHUB_WORKFLOW} sur ${GITHUB_REF_NAME} (run #${GITHUB_RUN_NUMBER}) : ${{ job.status }}" \
"${{ secrets.NTFY_URL }}/${{ secrets.NTFY_TOPIC }}" || true