Skip to content

Commit

Permalink
Add version information to container
Browse files Browse the repository at this point in the history
  • Loading branch information
antonijn committed Jan 27, 2024
1 parent 134d66c commit 6ca2b47
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
VERSION_TAG=${{ github.ref_name }}
# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ WORKDIR /app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
ARG VERSION_TAG=unknown
ENV MQTT4DSMR_VERSION=$VERSION_TAG
CMD [ "env", "SERIAL_DEVICE=/dev/ttyDSMR", "./mqtt4dsmr.py" ]
5 changes: 4 additions & 1 deletion mqtt4dsmr.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

import logging
import os
import sys
from dsmr_parser.clients import SerialReader
import paho.mqtt.client as mqtt
Expand All @@ -24,7 +25,9 @@


def main():
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s')
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO)
version = os.getenv('MQTT4DSMR_VERSION', 'unknown')
logging.info(f'Using mqtt4dsmr {version}')

cfg = Config()

Expand Down

0 comments on commit 6ca2b47

Please sign in to comment.