mirror of
https://github.com/tebarius/Docker-Flask-QR.git
synced 2025-12-21 14:33:31 +01:00
Compare commits
2 Commits
34d65660c3
...
4418d0714c
| Author | SHA1 | Date | |
|---|---|---|---|
| 4418d0714c | |||
| ba3ac0a52b |
6
.idea/GitLink.xml
generated
Normal file
6
.idea/GitLink.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="uk.co.ben_gibson.git.link.SettingsState">
|
||||||
|
<option name="host" value="72037fcc-cb9c-4c22-960a-ffe73fd5e229" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
31
.idea/workspace.xml
generated
31
.idea/workspace.xml
generated
@@ -9,17 +9,12 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="3fdfc273-527d-4717-bd6d-4ba98fba7555" name="Changes" comment="URLs in readme.md auf ghcr.io">
|
<list default="true" id="3fdfc273-527d-4717-bd6d-4ba98fba7555" name="Changes" comment="Bugfixes in wifi-qr + update DockerImages to v1.2.1">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/.idea/GitLink.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/runConfigurations/Dockerfile_Raspi.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/runConfigurations/Dockerfile_Raspi.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/runConfigurations/Dockerfile_local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/runConfigurations/Dockerfile_local.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Dockerfile" beforeDir="false" afterPath="$PROJECT_DIR$/Dockerfile" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Dockerfile" beforeDir="false" afterPath="$PROJECT_DIR$/Dockerfile" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Dockerfile-RasPi" beforeDir="false" afterPath="$PROJECT_DIR$/Dockerfile-RasPi" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Dockerfile-RasPi" beforeDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/app/GET-Flask-QR.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/GET-Flask-QR.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/readme.md" beforeDir="false" afterPath="$PROJECT_DIR$/readme.md" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/app/POST-Flask-QR.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/POST-Flask-QR.py" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/app/post-templates/wifi.html" beforeDir="false" afterPath="$PROJECT_DIR$/app/post-templates/wifi.html" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/app/qr-static/style.css" beforeDir="false" afterPath="$PROJECT_DIR$/app/qr-static/style.css" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -88,8 +83,9 @@
|
|||||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
|
"git-widget-placeholder": "multiarch-docker",
|
||||||
"ignore.virus.scanning.warn.message": "true",
|
"ignore.virus.scanning.warn.message": "true",
|
||||||
"last_opened_file_path": "D:/mager/Documents/IntelliJ/Docker-Flask-QR/app/POST-Flask-QR.py",
|
"last_opened_file_path": "D:/mager/Documents/IntelliJ/Docker-Flask-QR",
|
||||||
"project.structure.last.edited": "Project",
|
"project.structure.last.edited": "Project",
|
||||||
"project.structure.proportion": "0.15",
|
"project.structure.proportion": "0.15",
|
||||||
"project.structure.side.proportion": "0.2",
|
"project.structure.side.proportion": "0.2",
|
||||||
@@ -98,8 +94,8 @@
|
|||||||
}]]></component>
|
}]]></component>
|
||||||
<component name="RecentsManager">
|
<component name="RecentsManager">
|
||||||
<key name="CopyFile.RECENT_KEYS">
|
<key name="CopyFile.RECENT_KEYS">
|
||||||
<recent name="$PROJECT_DIR$/app/get-templates" />
|
|
||||||
<recent name="D:\mager\Documents\IntelliJ\Docker-Flask-QR" />
|
<recent name="D:\mager\Documents\IntelliJ\Docker-Flask-QR" />
|
||||||
|
<recent name="$PROJECT_DIR$/app/get-templates" />
|
||||||
<recent name="D:\mager\Documents\IntelliJ\Docker-Flask-QR\app" />
|
<recent name="D:\mager\Documents\IntelliJ\Docker-Flask-QR\app" />
|
||||||
<recent name="$PROJECT_DIR$/app/templates" />
|
<recent name="$PROJECT_DIR$/app/templates" />
|
||||||
<recent name="D:\mager\Documents\IntelliJ\Docker-Flask-QR\app\templates" />
|
<recent name="D:\mager\Documents\IntelliJ\Docker-Flask-QR\app\templates" />
|
||||||
@@ -290,7 +286,15 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1700154394950</updated>
|
<updated>1700154394950</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="14" />
|
<task id="LOCAL-00014" summary="Bugfixes in wifi-qr + update DockerImages to v1.2.1">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1704660840945</created>
|
||||||
|
<option name="number" value="00014" />
|
||||||
|
<option name="presentableId" value="LOCAL-00014" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1704660840970</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="15" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
@@ -329,7 +333,8 @@
|
|||||||
<MESSAGE value="ENV-Variable HTTP_METHOD eingeführt" />
|
<MESSAGE value="ENV-Variable HTTP_METHOD eingeführt" />
|
||||||
<MESSAGE value="readme.md geschrieben und Container auf Docker-Hub" />
|
<MESSAGE value="readme.md geschrieben und Container auf Docker-Hub" />
|
||||||
<MESSAGE value="URLs in readme.md auf ghcr.io" />
|
<MESSAGE value="URLs in readme.md auf ghcr.io" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="URLs in readme.md auf ghcr.io" />
|
<MESSAGE value="Bugfixes in wifi-qr + update DockerImages to v1.2.1" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="Bugfixes in wifi-qr + update DockerImages to v1.2.1" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XSLT-Support.FileAssociations.UIState">
|
<component name="XSLT-Support.FileAssociations.UIState">
|
||||||
<expand />
|
<expand />
|
||||||
|
|||||||
19
Dockerfile
19
Dockerfile
@@ -1,17 +1,26 @@
|
|||||||
FROM python:slim
|
FROM python:slim
|
||||||
|
|
||||||
|
ARG TARGETPLATFORM
|
||||||
|
ARG BUILDPLATFORM
|
||||||
|
|
||||||
LABEL authors="tebarius"
|
LABEL authors="tebarius"
|
||||||
LABEL version="1.2.1"
|
LABEL version="1.3.0"
|
||||||
LABEL description="QR-Code-Generator-Server with Flask-App"
|
LABEL description="QR-Code-Generator-Server with Flask-App"
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY ./app /app/
|
COPY ./app /app/
|
||||||
|
|
||||||
RUN pip install --upgrade pip
|
RUN apt-get update && \
|
||||||
RUN pip install --trusted-host pypi.python.org -r requirements.txt
|
if [ "$TARGETPLATFORM" = "linux/arm/v7" ] || [ "$TARGETPLATFORM" = "linux/386" ]; then \
|
||||||
|
apt-get install -y --no-install-recommends zlib1g-dev libjpeg-dev gcc; \
|
||||||
|
fi && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN pip install --no-cache-dir --trusted-host pypi.python.org -r requirements.txt
|
||||||
|
|
||||||
EXPOSE 8002
|
EXPOSE 8002
|
||||||
|
|
||||||
ENV HTTP_METHOD POST
|
ENV HTTP_METHOD=POST
|
||||||
|
|
||||||
CMD ["sh", "-c", "python ${HTTP_METHOD}-Flask-QR.py"]
|
CMD ["sh", "-c", "python ${HTTP_METHOD}-Flask-QR.py"]
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
FROM python:slim
|
|
||||||
|
|
||||||
LABEL authors="tebarius"
|
|
||||||
LABEL version="1.2.1"
|
|
||||||
LABEL description="QR-Code-Generator-Server with Flask-App"
|
|
||||||
LABEL platform="Raspberry Pi 3 with Raspian"
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
COPY ./app /app/
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y gcc zlib1g-dev libjpeg-dev
|
|
||||||
RUN python -m pip install --upgrade pip
|
|
||||||
#RUN python -m pip install --upgrade pillow
|
|
||||||
RUN pip install --trusted-host pypi.python.org -r requirements.txt
|
|
||||||
|
|
||||||
EXPOSE 8002
|
|
||||||
|
|
||||||
ENV HTTP_METHOD POST
|
|
||||||
|
|
||||||
CMD ["sh", "-c", "python ${HTTP_METHOD}-Flask-QR.py"]
|
|
||||||
32
readme.md
32
readme.md
@@ -1,49 +1,45 @@
|
|||||||
# Flask QR-Code-Generator
|
# Flask QR-Code-Generator
|
||||||
Sorry folks, because this project startet as experiment for Flask and Docker only german description and manual.
|
Sorry folks, because this project startet as experiment for Flask and Docker only german description and manual.
|
||||||
|
|
||||||
HTTP-Server auf Port 8002 mit QR-Code-Generator zur Generierung verschiedener Arten von QR-Codes (Text, URL, Mail, Tel., WIFI, Kalender-Event, vCard, MeCard).
|
HTTP-Server auf Port 8002 mit QR-Code-Generator zur Generierung verschiedener Arten von QR-Codes (Text, URL, Mail,
|
||||||
|
Tel., WIFI, Kalender-Event, vCard, MeCard).
|
||||||
|
|
||||||
Eigentlich ist das Projekt für mich ein Experimentierfeld gewesen um mal Flask ein bisschen auszuprobieren
|
Eigentlich ist das Projekt für mich ein Experimentierfeld gewesen um mal Flask ein bisschen auszuprobieren
|
||||||
|
|
||||||
## ohne Docker
|
## ohne Docker
|
||||||
Um lokal das ganze zu testen werden nur die Dateien aus dem app-Verzeichnis benötigt.
|
Um lokal das ganze zu testen werden nur die Dateien aus dem app-Verzeichnis benötigt.
|
||||||
Voraussetzung ist eine funktionierende Python Installation (ich habe nur mit Python 3.11 und 3.12 getestet) und das Flask-Framework inclusive Flask-QRcode welches sich recht einfach über die Konsole mit ...
|
Voraussetzung ist eine funktionierende Python Installation und das Flask-Framework inclusive Flask-QRcode welches sich
|
||||||
|
recht einfach über die Konsole mit ...
|
||||||
|
|
||||||
pip install Flask-QRcode
|
pip install Flask-QRcode
|
||||||
... installieren lässt.
|
... installieren lässt.
|
||||||
|
|
||||||
Zum Starten dann eine der beiden .py Dateien benutzen, je nachdem welcher
|
Zum Starten dann eine der beiden .py Dateien benutzen, je nachdem welcher
|
||||||
HTTP-Modus gewollt ist. Im Zweifelsfall POST ... nehmen und wenn ein Doppelklick nicht geht dann halt über die Konsole: `python POST-Flask-QR.py`
|
HTTP-Modus gewollt ist. Im Zweifelsfall POST ... nehmen und wenn ein Doppelklick nicht geht dann halt über
|
||||||
|
die Konsole: `python POST-Flask-QR.py`
|
||||||
|
|
||||||
Der Server ist dann via http://localhost:8002 zu erreichen
|
Der Server ist dann via http://localhost:8002 zu erreichen
|
||||||
|
|
||||||
## Docker
|
## Docker
|
||||||
Es gibt 2 unterschiedliche Dockerfile's, da obwohl bei beiden python:slim als Basis genutzt wird,
|
Ab Version 1.3.0 des Containers ist es ein Multi-Architektur-DockerContainer für AMD64, ARM64, i386 und ARMv7
|
||||||
noch die Installation von ein paar packages zusätzlich notwendig ist, damit flask auch auf
|
|
||||||
dem RaspberryPi 3 via pip install integriert werden kann.
|
|
||||||
|
|
||||||
In der Standardeinstellung werden die Formulare mit HTTP-POST-Anfragen gesendet/verarbeitet.
|
In der Standardeinstellung werden die Formulare mit HTTP-POST-Anfragen gesendet/verarbeitet.
|
||||||
Sollte es Gründe geben, warum gewünscht wird, dass dies der HTTP-GET-Variante zu machen, lässt sich das über die Enviroment Variable HTTP_METHOD ändern.
|
Sollte es Gründe geben, warum gewünscht wird, dass dies der HTTP-GET-Variante zu machen, lässt sich das über die
|
||||||
|
Enviroment Variable `HTTP_METHOD` ändern.
|
||||||
|
|
||||||
## Enviroment-Variablen
|
## Enviroment-Variablen
|
||||||
|
|
||||||
- `HTTP_METHOD` GET oder POST (default: POST)
|
- `HTTP_METHOD` GET oder POST (default: POST)
|
||||||
|
|
||||||
## Docker Installation/Start
|
## Docker Installation/Start
|
||||||
https://hub.docker.com/r/tebarius/flask-qrcode-generator
|
|
||||||
### Linux/AMD64
|
### Installation
|
||||||
|
siehe https://hub.docker.com/r/tebarius/flask-qrcode-generator
|
||||||
|
|
||||||
|
oder via Github-Docker-Registry:
|
||||||
- einfacher Start:
|
- einfacher Start:
|
||||||
`docker run -d -p 8002:8002 ghcr.io/tebarius/flask-qrcode-generator:latest`
|
`docker run -d -p 8002:8002 ghcr.io/tebarius/flask-qrcode-generator:latest`
|
||||||
erreichbar dann z.B. via http://localhost:8002
|
erreichbar dann z.B. via http://localhost:8002
|
||||||
- mit HTTP-Methode GET auf Port 80:
|
- mit HTTP-Methode GET auf Port 80:
|
||||||
`docker run -d -p 80:8002 -e HTTP_METHOD=GET ghcr.io/tebarius/flask-qrcode-generator:latest`
|
`docker run -d -p 80:8002 -e HTTP_METHOD=GET ghcr.io/tebarius/flask-qrcode-generator:latest`
|
||||||
erreichbar dann z.B. via http://localhost
|
erreichbar dann z.B. via http://localhost
|
||||||
|
|
||||||
### Linux/ARMv7 (getestet mit RaspberryPi 3)
|
|
||||||
- einfacher Start:
|
|
||||||
`docker run -d -p 8002:8002 ghcr.io/tebarius/flask-qrcode-generator:armv7-latest`
|
|
||||||
erreichbar dann z.B. via http://localhost:8002
|
|
||||||
- mit HTTP-Methode GET auf Port80:
|
|
||||||
`docker run -d -p 80:8002 -e HTTP_METHOD=GET ghcr.io/tebarius/flask-qrcode-generator:armv7-latest`
|
|
||||||
erreichbar dann z.B. via http://localhost
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user