Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a0378bad9c | |||
| fcd1ee55a8 | |||
| fc0244cc22 | |||
| f29fb3ae44 | |||
| 96dbea735c | |||
| 8a3e9956e9 | |||
| 6126680562 | |||
| 4e8ac6f21a |
@@ -1,13 +1,10 @@
|
||||
name: build-image
|
||||
run-name: build and push Docker-Image
|
||||
run-name: build and push Docker-Image with tag:${{ github.ref_name }}
|
||||
|
||||
on:
|
||||
workflow_dispatch: # Manuelles Auslösen des Workflows
|
||||
inputs:
|
||||
image_tag:
|
||||
description: '2. Tag für das Docker-Image (außer latest) (z.B. v1.0.0)'
|
||||
required: true
|
||||
default: '1.0.0'
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
|
||||
env:
|
||||
image_name: mysteryhelfer
|
||||
@@ -47,7 +44,34 @@ jobs:
|
||||
--file ./Dockerfile \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--tag ${{ env.registry_gitea }}/${{ env.user }}/${{ env.image_name }}:latest \
|
||||
--tag ${{ env.registry_gitea }}/${{ env.user }}/${{ env.image_name }}:${{ github.event.inputs.image_tag }} \
|
||||
--tag ${{ env.registry_gitea }}/${{ env.user }}/${{ env.image_name }}:${{ github.ref_name }} \
|
||||
--tag ${{ env.user }}/${{ env.image_name }}:latest \
|
||||
--tag ${{ env.user }}/${{ env.image_name }}:${{ github.event.inputs.image_tag }} \
|
||||
--tag ${{ env.user }}/${{ env.image_name }}:${{ github.ref_name }} \
|
||||
--push ./
|
||||
telegram-notify:
|
||||
needs: release-image
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Telegram Alert
|
||||
run: |
|
||||
case "${{ needs.release-image.result }}" in
|
||||
"success") EMOJI="✅"; MSG="OK" ;;
|
||||
"failure") EMOJI="❌"; MSG="WARN!" ;;
|
||||
"cancelled") EMOJI="⏹️"; MSG="Canceled" ;;
|
||||
*) EMOJI="❓"; MSG="Unknown-State: ${{ needs.release-image.result }}" ;;
|
||||
esac
|
||||
|
||||
curl -s -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d "{
|
||||
\"chat_id\": \"${{ secrets.TELEGRAM_CHAT_ID }}\",
|
||||
\"parse_mode\": \"HTML\",
|
||||
\"text\":
|
||||
\"$EMOJI <b>$MSG - Build ${{ env.image_name }}:${{ github.ref_name }}</b>
|
||||
<i>$(date +"%Y-%m-%d %T")</i>
|
||||
Build of Image: <b><i>${{ env.image_name }}:${{ github.ref_name }}</i></b>
|
||||
${{ gitea.server_url }}/${{ gitea.repository }}
|
||||
\"
|
||||
}"
|
||||
|
||||
@@ -22,11 +22,48 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
container: aquasec/trivy:latest
|
||||
steps:
|
||||
- name: Scan image with trivy
|
||||
- name: Scan linux/amd64-image
|
||||
run: |
|
||||
trivy image \
|
||||
--exit-code 1 \
|
||||
--scanners vuln,misconfig,secret \
|
||||
--severity MEDIUM,HIGH,CRITICAL \
|
||||
--severity HIGH,CRITICAL \
|
||||
--ignore-unfixed \
|
||||
--platform linux/amd64 \
|
||||
${{ env.registry_gitea }}/${{ env.user }}/${{ env.image_name }}:${{ env.image_tag }}
|
||||
- name: Scan linux/arm64-image
|
||||
run: |
|
||||
trivy image \
|
||||
--exit-code 1 \
|
||||
--scanners vuln,misconfig,secret \
|
||||
--severity HIGH,CRITICAL \
|
||||
--ignore-unfixed \
|
||||
--platform linux/arm64 \
|
||||
${{ env.registry_gitea }}/${{ env.user }}/${{ env.image_name }}:${{ env.image_tag }}
|
||||
|
||||
telegram-notify:
|
||||
needs: trivy_image_scan
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Telegram Alert
|
||||
run: |
|
||||
case "${{ needs.trivy_image_scan.result }}" in
|
||||
"success") EMOJI="✅"; MSG="OK" ;;
|
||||
"failure") EMOJI="❌"; MSG="WARN!" ;;
|
||||
"cancelled") EMOJI="⏹️"; MSG="Canceled" ;;
|
||||
*) EMOJI="❓"; MSG="Unknown-State: ${{ needs.trivy_image_scan.result }}" ;;
|
||||
esac
|
||||
|
||||
curl -s -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d "{
|
||||
\"chat_id\": \"${{ secrets.TELEGRAM_CHAT_ID }}\",
|
||||
\"parse_mode\": \"HTML\",
|
||||
\"text\":
|
||||
\"$EMOJI <b>$MSG - Scan ${{ env.image_name }}:${{ env.image_tag }}</b>
|
||||
<i>$(date +"%Y-%m-%d %T")</i>
|
||||
Trivy-Image-Scan of: <b><i>${{ env.image_name }}:${{ env.image_tag }}</i></b>
|
||||
${{ gitea.server_url }}/${{ gitea.repository }}
|
||||
\"
|
||||
}"
|
||||
|
||||
@@ -7,8 +7,8 @@ LABEL description="tebarius Mysteryhelfer web"
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get upgrade -y \
|
||||
&& apt-get install -y --no-install-recommends curl \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Reference in New Issue
Block a user