ci: dockerise le front (build Vite/pnpm -> nginx) + workflow Gitea Actions
- DataSentinel/Dockerfile (node 22 + pnpm + nginx) + nginx.conf (SPA + headers sécurité) - workflow build/push image avec VITE_API_URL=https://datasentinel-api.nfteam.ovh
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
name: Build & Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch: {}
|
||||
|
||||
env:
|
||||
IMAGE: git.nfteam.ovh/neckfire/datasentinel-front
|
||||
VITE_API_URL: https://datasentinel-api.nfteam.ovh
|
||||
|
||||
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 --build-arg VITE_API_URL="${VITE_API_URL}" \
|
||||
-t "${IMAGE}:latest" -t "${IMAGE}:${GITHUB_SHA::12}" ./DataSentinel
|
||||
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
|
||||
Reference in New Issue
Block a user