Skip to content

Commit fe263b5

Browse files
committed
Merge branch 'tosate-feat/add-version-info' into develop
2 parents fde8077 + 629cfe6 commit fe263b5

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

.github/workflows/build_python_mqtt_dev_images.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ jobs:
5252
if: env.DOCKERHUB_ORGANIZATION == null
5353
with:
5454
context: .
55+
build-args: |
56+
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
5557
platforms: linux/amd64,linux/arm64,linux/arm/v7
5658
push: true
5759
cache-from: type=gha
@@ -65,6 +67,8 @@ jobs:
6567
if: env.DOCKERHUB_ORGANIZATION != null
6668
with:
6769
context: .
70+
build-args: |
71+
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
6872
platforms: linux/amd64,linux/arm64,linux/arm/v7
6973
push: true
7074
cache-from: type=gha

.github/workflows/build_python_mqtt_images.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ jobs:
5252
if: env.DOCKERHUB_ORGANIZATION == null
5353
with:
5454
context: .
55+
build-args: |
56+
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
5557
platforms: linux/amd64,linux/arm64,linux/arm/v7
5658
push: true
5759
tags: |
@@ -63,6 +65,8 @@ jobs:
6365
if: env.DOCKERHUB_ORGANIZATION != null
6466
with:
6567
context: .
68+
build-args: |
69+
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
6670
platforms: linux/amd64,linux/arm64,linux/arm/v7
6771
push: true
6872
tags: |

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@ RUN poetry install --no-root && rm -rf $POETRY_CACHE_DIR
1818
# We'll just copy the env and the PATH reference.
1919
FROM python:${PYTHON_VERSION}-slim AS runtime
2020

21+
ARG RELEASE_VERSION=latest
22+
23+
LABEL saic.mqtt.gateway.version="${RELEASE_VERSION}"
24+
LABEL saic.mqtt.gateway.description="SAIC MQTT Gateway: A Python-based service that queries the SAIC API, processes the data, and publishes it to an MQTT broker."
25+
2126
WORKDIR /usr/src/app
2227

28+
ENV RELEASE_VERSION=${RELEASE_VERSION}
2329
ENV VIRTUAL_ENV=/usr/src/app/.venv
2430
ENV PATH="/usr/src/app/.venv/bin:$PATH"
2531

src/main.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import asyncio
44
import faulthandler
5+
import logging
6+
import os
57
import signal
68
import sys
79

@@ -13,6 +15,10 @@
1315
from log_config import debug_log_enabled, setup_logging
1416

1517
setup_logging()
18+
log = logging.getLogger(__name__)
19+
log.info(
20+
f"Starting SAIC MQTT Gateway version {os.environ.get('RELEASE_VERSION', 'unknown')}"
21+
)
1622

1723
# Enable fault handler to get a thread dump on SIGQUIT
1824
faulthandler.enable(file=sys.stderr, all_threads=True)

0 commit comments

Comments
 (0)