Compare commits
21 Commits
6ad32fc796
...
1.6.4
| Author | SHA1 | Date | |
|---|---|---|---|
| 95fa832a67 | |||
| cb460ef18d | |||
| 7f54789e0c | |||
| 20bda0cbd5 | |||
| 7560904223 | |||
| 805db14672 | |||
| 6cb3fc1ebb | |||
| 62b59d3c52 | |||
| e2b2c5e89c | |||
| c6a5c83321 | |||
| 246dd03eec | |||
| 5053791991 | |||
| 794bc5cb97 | |||
| 2a5b133ba7 | |||
| 05615dc813 | |||
| 59b5b9154e | |||
| 3244dfaf77 | |||
| abbf38d860 | |||
| 2f0a3fc521 | |||
| 4a10565af1 | |||
| d7f8544f6b |
65
.gitea/workflows/create_and_push_multiarch_container.yml
Normal file
65
.gitea/workflows/create_and_push_multiarch_container.yml
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
name: build-image
|
||||||
|
run-name: build and push Docker-Image
|
||||||
|
|
||||||
|
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.6.0'
|
||||||
|
|
||||||
|
env:
|
||||||
|
image_name_gitea: flask-qr
|
||||||
|
image_name_github: flask-qrcode-generator
|
||||||
|
image_name_dockerhub: flask-qrcode-generator
|
||||||
|
registry_gitea: gitea.tebarius.duckdns.org
|
||||||
|
registry_github: ghcr.io
|
||||||
|
user: tebarius
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-image:
|
||||||
|
runs-on: build-ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
- name: Login to Gitea
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ${{ env.registry_gitea }}
|
||||||
|
username: ${{ env.user }}
|
||||||
|
password: ${{ secrets.IMAGE_REGISTRY_TOKEN_GITEA }}
|
||||||
|
|
||||||
|
- name: Login to Github
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ${{ env.registry_github }}
|
||||||
|
username: ${{ env.user }}
|
||||||
|
password: ${{ secrets.TOKEN_GITHUB }}
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ env.user }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
run: |
|
||||||
|
# Stelle sicher, dass Buildx aktiviert ist
|
||||||
|
docker buildx create --use
|
||||||
|
|
||||||
|
# Führe den Multiarch-Build aus und pushe das Image
|
||||||
|
docker buildx build \
|
||||||
|
--file ./Dockerfile \
|
||||||
|
--platform linux/amd64,linux/386,linux/arm64,linux/arm/v7 \
|
||||||
|
--tag ${{ env.registry_gitea }}/${{ env.user }}/${{ env.image_name_gitea }}:${{ github.event.inputs.image_tag }} \
|
||||||
|
--tag ${{ env.registry_github }}/${{ env.user }}/${{ env.image_name_github }}:${{ github.event.inputs.image_tag }} \
|
||||||
|
--tag ${{ env.user }}/${{ env.image_name_dockerhub }}:${{ github.event.inputs.image_tag }} \
|
||||||
|
--tag ${{ env.registry_gitea }}/${{ env.user }}/${{ env.image_name_gitea }}:latest \
|
||||||
|
--tag ${{ env.registry_github }}/${{ env.user }}/${{ env.image_name_github }}:latest \
|
||||||
|
--tag ${{ env.user }}/${{ env.image_name_dockerhub }}:latest \
|
||||||
|
--push ./
|
||||||
95
.gitea/workflows/trivy_image_scan.yml
Normal file
95
.gitea/workflows/trivy_image_scan.yml
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
name: trivy-scan-image
|
||||||
|
run-name: Trivy - Scan Docker Image ${{ env.image_tag }}
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch: # Manuelles Auslösen des Workflows
|
||||||
|
inputs:
|
||||||
|
image_tag:
|
||||||
|
description: 'Tag für das zu scannende Docker-Image z.B. latest'
|
||||||
|
required: true
|
||||||
|
default: 'latest'
|
||||||
|
schedule:
|
||||||
|
- cron: '30 1 * * 5'
|
||||||
|
|
||||||
|
env:
|
||||||
|
image_name_gitea: flask-qr
|
||||||
|
image_tag: ${{ github.event.inputs.image_tag || 'latest' }}
|
||||||
|
registry_gitea: gitea.tebarius.duckdns.org
|
||||||
|
user: tebarius
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
trivy_image_scan:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: aquasec/trivy:latest
|
||||||
|
steps:
|
||||||
|
- name: Scan linux/amd64-image
|
||||||
|
run: |
|
||||||
|
trivy image \
|
||||||
|
--username ${{ env.user }} \
|
||||||
|
--password ${{ secrets.DOCKER_PULL_TOKEN }} \
|
||||||
|
--exit-code 1 \
|
||||||
|
--scanners vuln,misconfig,secret \
|
||||||
|
--severity HIGH,CRITICAL \
|
||||||
|
--ignore-unfixed \
|
||||||
|
--platform linux/amd64 \
|
||||||
|
${{ env.registry_gitea }}/${{ env.user }}/${{ env.image_name_gitea }}:${{ env.image_tag }}
|
||||||
|
- name: Scan linux/386-image
|
||||||
|
run: |
|
||||||
|
trivy image \
|
||||||
|
--username ${{ env.user }} \
|
||||||
|
--password ${{ secrets.DOCKER_PULL_TOKEN }} \
|
||||||
|
--exit-code 1 \
|
||||||
|
--scanners vuln,misconfig,secret \
|
||||||
|
--severity HIGH,CRITICAL \
|
||||||
|
--ignore-unfixed \
|
||||||
|
--platform linux/386 \
|
||||||
|
${{ env.registry_gitea }}/${{ env.user }}/${{ env.image_name_gitea }}:${{ env.image_tag }}
|
||||||
|
- name: Scan linux/arm64-image
|
||||||
|
run: |
|
||||||
|
trivy image \
|
||||||
|
--username ${{ env.user }} \
|
||||||
|
--password ${{ secrets.DOCKER_PULL_TOKEN }} \
|
||||||
|
--exit-code 1 \
|
||||||
|
--scanners vuln,misconfig,secret \
|
||||||
|
--severity HIGH,CRITICAL \
|
||||||
|
--ignore-unfixed \
|
||||||
|
--platform linux/arm64 \
|
||||||
|
${{ env.registry_gitea }}/${{ env.user }}/${{ env.image_name_gitea }}:${{ env.image_tag }}
|
||||||
|
- name: Scan linux/arm/v7-image
|
||||||
|
run: |
|
||||||
|
trivy image \
|
||||||
|
--username ${{ env.user }} \
|
||||||
|
--password ${{ secrets.DOCKER_PULL_TOKEN }} \
|
||||||
|
--exit-code 1 \
|
||||||
|
--scanners vuln,misconfig,secret \
|
||||||
|
--severity HIGH,CRITICAL \
|
||||||
|
--ignore-unfixed \
|
||||||
|
--platform linux/arm/v7 \
|
||||||
|
${{ env.registry_gitea }}/${{ env.user }}/${{ env.image_name_gitea }}:${{ 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_gitea }}:${{ env.image_tag }}</b>
|
||||||
|
<i>$(date +"%Y-%m-%d %T")</i>
|
||||||
|
Trivy-Image-Scan of: <b><i>${{ env.image_name_gitea }}:${{ env.image_tag }}</i></b>
|
||||||
|
${{ gitea.server_url }}/${{ gitea.repository }}
|
||||||
|
\"
|
||||||
|
}"
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
/venv/
|
/venv/
|
||||||
|
/.venv/
|
||||||
|
|||||||
28
Dockerfile
28
Dockerfile
@@ -1,27 +1,31 @@
|
|||||||
FROM python:3.13-slim
|
FROM python:3.14-slim
|
||||||
|
LABEL authors="tebarius"
|
||||||
|
LABEL description="QR-Code-Generator-Server with Flask-App"
|
||||||
|
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
ARG BUILDPLATFORM
|
ARG BUILDPLATFORM
|
||||||
|
ENV PYTHONDONTWRITEBYTECODE=1
|
||||||
LABEL authors="tebarius"
|
ENV PYTHONUNBUFFERED=1
|
||||||
LABEL version="1.5.0"
|
ENV HTTP_METHOD=POST
|
||||||
LABEL description="QR-Code-Generator-Server with Flask-App"
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
COPY ./app /app/
|
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
|
apt-get upgrade -y &&\
|
||||||
if [ "$TARGETPLATFORM" = "linux/arm/v7" ] || [ "$TARGETPLATFORM" = "linux/386" ]; then \
|
if [ "$TARGETPLATFORM" = "linux/arm/v7" ] || [ "$TARGETPLATFORM" = "linux/386" ]; then \
|
||||||
apt-get install -y --no-install-recommends zlib1g-dev libjpeg-dev gcc; \
|
apt-get install -y --no-install-recommends zlib1g-dev libjpeg-dev gcc; \
|
||||||
fi && \
|
fi && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN python -m pip install --upgrade pip
|
WORKDIR /app
|
||||||
RUN pip install --no-cache-dir --trusted-host pypi.python.org -r requirements.txt
|
COPY ./app /app/
|
||||||
|
|
||||||
|
RUN python -m pip install --upgrade pip \
|
||||||
|
&& pip install --no-cache-dir -r requirements.txt \
|
||||||
|
&& useradd -m -u 1000 qr \
|
||||||
|
&& chown -R qr:qr /app
|
||||||
|
|
||||||
|
USER qr
|
||||||
|
|
||||||
EXPOSE 8002
|
EXPOSE 8002
|
||||||
|
|
||||||
ENV HTTP_METHOD=POST
|
|
||||||
|
|
||||||
CMD ["sh", "-c", "python ${HTTP_METHOD}-Flask-QR.py"]
|
CMD ["sh", "-c", "python ${HTTP_METHOD}-Flask-QR.py"]
|
||||||
|
|||||||
Reference in New Issue
Block a user