5 Commits

Author SHA1 Message Date
85afd501ce version id, 2
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-02-01 09:55:40 +01:00
4dbc156439 version id
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-02-01 09:48:54 +01:00
fd3e8751fe order by name
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-02-01 09:28:26 +01:00
21ea1aa56f Merge branch 'main' of gitea.hottis.de:moerp/elo-rezept-rechner
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-01-31 16:46:36 +01:00
eefc8d5b21 fix image tag 2024-01-31 16:46:31 +01:00
5 changed files with 12 additions and 4 deletions

View File

@ -10,6 +10,9 @@ steps:
from_secret: container_registry_username
password:
from_secret: container_registry_password
build_args:
- VERSION_ID1=${CI_COMMIT_SHA}
- VERSION_ID2=${CI_COMMIT_TAG}
dockerfile: Dockerfile
when:
- event: [push, tag]

View File

@ -1,6 +1,8 @@
FROM python:3.12-alpine3.19
ARG APP_DIR="/opt/app"
ARG VERSION_ID1="x"
ARG VERSION_ID2="alpha"
COPY ./src/ ${APP_DIR}/
COPY start.sh ${APP_DIR}/
@ -9,7 +11,9 @@ WORKDIR ${APP_DIR}
RUN \
apk add --no-cache build-base libpq-dev && \
pip install -r requirements.txt
pip install -r requirements.txt && \
if [ "${VERSION_ID2}" != "" ]; then VERSION_ID=${VERSION_ID2}; else VERSION_ID=${VERSION_ID1}; fi && \
sed -i -e 's/VERSION_ID/'$VERSION_ID'/' ${APP_DIR}/templates/index.html
EXPOSE 8080

View File

@ -2,7 +2,7 @@
if [ "$1" == "test" ]; then
POSTFIX="-test"
IMAGE_TAG="latest"
IMAGE_TAG=${CI_COMMIT_SHA}
else
POSTFIX=""
fi

View File

@ -65,7 +65,7 @@ def get_products():
try:
conn = psycopg2.connect()
with conn.cursor() as cursor:
cursor.execute('SELECT name FROM nutrition_table')
cursor.execute('SELECT name FROM nutrition_table ORDER BY name')
products = cursor.fetchall()
return {'products': [product[0] for product in products]}
finally:

View File

@ -177,6 +177,7 @@ function updateTotalNutrition() {
<nav id="navbar">
<h1>Elo's Rezept Rechner</h1>
<ul>
<li class="versionid">VERSION_ID</li>
<li><a href="/" class="active">Rechner</a></li>
<li><a href="/nutrition">Neue Lebensmittel</a></li>
</ul>
@ -232,4 +233,4 @@ function updateTotalNutrition() {
</table>
</div>
</body>
</html>
</html>