Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 79c3cb83c7 | |||
| cb9fa61bc5 | |||
| 9a1e438615 | |||
| 787cb10e21 | |||
| ad208f3403 | |||
| b60316750a | |||
| 013a6b298e | |||
| f1dce2417f | |||
| 9947c205c7 | |||
| 8510169495 |
@@ -6,11 +6,11 @@ on:
|
||||
image_tag:
|
||||
description: '2. Tag für das Docker-Image (außer latest) (z.B. v1.0.0)'
|
||||
required: true
|
||||
default: '0.7.0'
|
||||
default: '0.7.3'
|
||||
|
||||
env:
|
||||
image_name: mysteryhelfer
|
||||
registry: gitea.tebarius.duckdns.org
|
||||
registry_gitea: gitea.tebarius.duckdns.org
|
||||
user: tebarius
|
||||
|
||||
jobs:
|
||||
@@ -26,9 +26,15 @@ jobs:
|
||||
- name: Login to Gitea
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ env.registry }}
|
||||
registry: ${{ env.registry_gitea }}
|
||||
username: ${{ env.user }}
|
||||
password: ${{ secrets.DOCKER_PULL_TOKEN }}
|
||||
password: ${{ secrets.IMAGE_REGISTRY_TOKEN_GITEA }}
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ env.user }}
|
||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
run: |
|
||||
@@ -39,6 +45,8 @@ jobs:
|
||||
docker buildx build \
|
||||
--file ./Dockerfile \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--tag ${{ env.registry }}/${{ env.user }}/${{ env.image_name }}:latest \
|
||||
--tag ${{ env.registry }}/${{ env.user }}/${{ env.image_name }}:${{ github.event.inputs.image_tag }} \
|
||||
--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.user }}/${{ env.image_name }}:latest \
|
||||
--tag ${{ env.user }}/${{ env.image_name }}:${{ github.event.inputs.image_tag }} \
|
||||
--push ./
|
||||
|
||||
28
.gitea/workflows/trivy_image_scan.yml
Normal file
28
.gitea/workflows/trivy_image_scan.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
name: release-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'
|
||||
|
||||
env:
|
||||
image_name: mysteryhelfer
|
||||
registry_gitea: gitea.tebarius.duckdns.org
|
||||
user: tebarius
|
||||
|
||||
jobs:
|
||||
trivy_image_scan:
|
||||
runs-on: ubuntu-latest
|
||||
container: aquasec/trivy:latest
|
||||
steps:
|
||||
- name: Scan image with trivy
|
||||
run: |
|
||||
trivy image \
|
||||
--exit-code 1 \
|
||||
--scanners vuln,misconfig,secret \
|
||||
--severity MEDIUM,HIGH,CRITICAL \
|
||||
--ignore-unfixed \
|
||||
${{ env.registry_gitea }}/${{ env.user }}/${{ env.image_name }}:${{ github.event.inputs.image_tag }}
|
||||
18
Dockerfile
18
Dockerfile
@@ -5,26 +5,30 @@ LABEL description="tebarius Mysteryhelfer web"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y curl \
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends curl \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY ./app /app
|
||||
|
||||
RUN python -m pip install --upgrade pip \
|
||||
&& pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
|
||||
# ein bisschen Patchen um auch beim Bookmarken oder Versenden der Webadresse per Messenger den richtigen Titel und das
|
||||
# richtige Favicon zu verwenden/sehen
|
||||
COPY ./app/images/favicon.ico /usr/local/lib/python3.13/site-packages/streamlit/static/favicon.ico
|
||||
RUN sed -i -e 's|favicon\.png|favicon.ico|' \
|
||||
-e 's|<title>.*</title>|<title>tebarius Mysteryhelfer (web)</title>|' \
|
||||
/usr/local/lib/python3.13/site-packages/streamlit/static/index.html
|
||||
|
||||
/usr/local/lib/python3.13/site-packages/streamlit/static/index.html \
|
||||
&& useradd -m -u 1000 myst \
|
||||
&& chown -R myst:myst /app
|
||||
USER myst
|
||||
|
||||
EXPOSE 8501
|
||||
|
||||
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
||||
|
||||
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
||||
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
||||
|
||||
@@ -172,11 +172,14 @@ def zeichenanzahl(eingabetext):
|
||||
else:
|
||||
anzahl[b] = 1
|
||||
s = []
|
||||
zeichensumme = 0
|
||||
for key in anzahl:
|
||||
s.append(key)
|
||||
zeichensumme += anzahl[key]
|
||||
s.sort()
|
||||
ausgabetext += f"Es wurden __:orange[{len(anzahl)}]__ unterschiedliche Zeichen gefunden. \n"
|
||||
ausgabetext += "| :blue[Zeichen] | :blue[Anzahl] |\n|----|----|\n"
|
||||
ausgabetext += (f"Es wurden __:orange[{len(anzahl)}]__ unterschiedliche Zeichen in insgesamt "
|
||||
f"__:orange[{zeichensumme}]__ Zeichen gefunden. \n"
|
||||
f"| :blue[Zeichen] | :blue[Anzahl] |\n|----|----|\n")
|
||||
for i in s:
|
||||
if ord(i) == 9:
|
||||
ausgabetext += f"|TAB|{anzahl[i]}|\n"
|
||||
|
||||
84
examples.py
84
examples.py
@@ -1,84 +0,0 @@
|
||||
# Copyright (c) 2025 Martin Kayser (tebarius)
|
||||
# Licensed under the MIT License. See LICENSE file in the project root.
|
||||
# start with: streamlit run examples.py
|
||||
import streamlit as st
|
||||
|
||||
|
||||
st.write("# Hello World !")
|
||||
|
||||
|
||||
import pandas as pd
|
||||
df = pd.DataFrame({
|
||||
'first column': [1, 2, 3, 4],
|
||||
'second column': [10, 20, 30, 40]
|
||||
})
|
||||
df
|
||||
|
||||
|
||||
st.table(df)
|
||||
|
||||
|
||||
import pandas as pd
|
||||
st.map(pd.DataFrame({'lat':[52.3642], 'lon':[13.0906]}), zoom=17, size=5)
|
||||
|
||||
|
||||
import streamlit as st
|
||||
x = st.slider('x', 32, 233) # 👈 this is a widget
|
||||
st.write(x, 'squared is', x * x)
|
||||
|
||||
|
||||
st.text_input("Your name", key="name")
|
||||
# You can access the value at any point with:
|
||||
st.session_state.name
|
||||
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
if st.checkbox('Show dataframe'):
|
||||
chart_data = pd.DataFrame(
|
||||
np.random.randn(20, 3),
|
||||
columns=['a', 'b', 'c'])
|
||||
chart_data
|
||||
|
||||
|
||||
import pandas as pd
|
||||
df = pd.DataFrame({
|
||||
'first column': [1, 2, 3, 4],
|
||||
'second column': [10, 20, 30, 40]
|
||||
})
|
||||
option = st.selectbox(
|
||||
'Which number do you like best?',
|
||||
df['first column'])
|
||||
'You selected: ', option
|
||||
|
||||
|
||||
add_selectbox = st.sidebar.selectbox(
|
||||
'How would you like to be contacted?',
|
||||
('Email', 'Home phone', 'Mobile phone')
|
||||
)
|
||||
# Add a slider to the sidebar:
|
||||
add_slider = st.sidebar.slider(
|
||||
'Select a range of values',
|
||||
0.0, 100.0, (25.0, 75.0)
|
||||
)
|
||||
|
||||
add_selectbox
|
||||
add_slider
|
||||
|
||||
|
||||
left_column, right_column = st.columns(2)
|
||||
# You can use a column just like st.sidebar:
|
||||
left_column.button('Press me!')
|
||||
# Or even better, call Streamlit functions inside a "with" block:
|
||||
with right_column:
|
||||
chosen = st.radio(
|
||||
'Sorting hat',
|
||||
("Gryffindor", "Ravenclaw", "Hufflepuff", "Slytherin"))
|
||||
st.write(f"You are in {chosen} house!")
|
||||
|
||||
|
||||
st.progress(80)
|
||||
|
||||
st.text_area("Your text", key="te")
|
||||
st.session_state.te
|
||||
23
readme.md
23
readme.md
@@ -7,23 +7,32 @@ Für die Umsetzung kommt das Python-Framework [Streamlit](https://streamlit.io/)
|
||||
Der einfachst Weg, um die App lokal laufen zu lassen, ist mit Docker, wobei ich hier mal 3 Möglichkeiten aufzeigen (_das vorgebaute Image ist als Multi-Arch-Image für linux/amd64,linux/arm64 gebaut und sollte somit z.B. auch auf Mac's und neueren Raspberry's mit 64 bit Betriebssystem laufen_):
|
||||
1. mit vorgebautem Image:
|
||||
- `docker run --rm -d -p 8501:8501 gitea.tebarius.duckdns.org/tebarius/mysteryhelfer`
|
||||
|
||||
- alternativ (via Docker Hub): `docker run --rm -d -p 8501:8501 tebarius/mysteryhelfer`
|
||||
2. mit vorgebautem Image und "docker compose"
|
||||
- docker-compose.yml erstellen mit folgendem Inhalt:
|
||||
```
|
||||
services:
|
||||
mysteryhelfer-web:
|
||||
image: gitea.tebarius.duckdns.org/tebarius/mysteryhelfer
|
||||
ports:
|
||||
- "8501:8501"
|
||||
restart: unless-stopped
|
||||
image: gitea.tebarius.duckdns.org/tebarius/mysteryhelfer
|
||||
ports:
|
||||
- "8501:8501"
|
||||
restart: unless-stopped
|
||||
```
|
||||
- `docker compose up`
|
||||
alternativ (via Docker Hub):
|
||||
```
|
||||
services:
|
||||
mysteryhelfer-web:
|
||||
image: tebarius/mysteryhelfer
|
||||
ports:
|
||||
- "8501:8501"
|
||||
restart: unless-stopped
|
||||
```
|
||||
- `docker compose up -d`
|
||||
|
||||
3. mit selbst gebautem Image aus dem Quellcode
|
||||
- `git clone https://gitea.tebarius.duckdns.org/tebarius/Mysteryhelfer-web.git`
|
||||
- `cd Mysteryhelfer-web`
|
||||
- `docker compose up`
|
||||
- `docker compose up -d`
|
||||
|
||||
bei allen 3 Varianten ist die App anschließend im Browser unter http://127.0.0.1:8501/ aufrufbar
|
||||
|
||||
|
||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Reference in New Issue
Block a user