diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 53ce3c3..e787074 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,6 +47,6 @@ jobs: IMAGE_NAME: ghcr.io/manimatter/decluttarr IMAGE_TAG: ${{ steps.setversion.outputs.new_tag }} run: | - docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_NAME:$IMAGE_TAG -t $IMAGE_NAME:latest -f docker/Dockerfile --push . + docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_NAME:$IMAGE_TAG -t $IMAGE_NAME:latest --label com.decluttarr.version=$IMAGE_TAG -f docker/Dockerfile --push . diff --git a/main.py b/main.py index 1f6e5ed..0689216 100644 --- a/main.py +++ b/main.py @@ -11,6 +11,8 @@ from src.decluttarr import queueCleaner import requests import platform from packaging import version + + ########### Enabling Logging # Set up logging log_level_num=logging.getLevelName(settings_dict['LOG_LEVEL']) @@ -58,7 +60,9 @@ async def main(): # Print Settings fmt = '{0.days} days {0.hours} hours {0.minutes} minutes' logger.info('#' * 50) - logger.info('Application Started!') + logger.info('Decluttarr - Application Started!') + if settings_dict['IS_IN_DOCKER']: + logger.info('Version: %s', get_image_tag()) logger.info('') logger.info('*** Current Settings ***') logger.info('%s | Removing failed downloads', str(settings_dict['REMOVE_FAILED'])) @@ -216,3 +220,16 @@ if __name__ == '__main__': download_sizes_tracker = Download_Sizes_Tracker({}) asyncio.run(main()) + +import docker +def get_image_tag(): + client = docker.from_env() + + try: + container_info = client.containers.get('decluttarr') + image_tag = container_info.labels.get('decluttarr.version', 'No image tag provided') + return image_tag + except docker.errors.NotFound: + return 'Container not found' + except Exception as e: + return f'Error retrieving image tag: {e}' \ No newline at end of file