From d0143119de99fd40e39e923fe111045a85796b96 Mon Sep 17 00:00:00 2001 From: "ricardo.bartels@telekom.de" Date: Sun, 10 Apr 2022 00:18:40 +0200 Subject: [PATCH] bump version to 1.2.3 --- Dockerfile | 23 ++++++++++++----------- README.md | 2 +- netbox-sync.py | 4 ++-- scripts/publish_docker.sh | 17 +++++++++++++++++ 4 files changed, 32 insertions(+), 14 deletions(-) create mode 100755 scripts/publish_docker.sh diff --git a/Dockerfile b/Dockerfile index 14c189e..8ac0faf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,17 +3,6 @@ FROM python:3.9-slim-bullseye # Install dependencies RUN apt-get update && apt-get -y upgrade && apt-get install -y git-core -# Prepare the application -COPY . /app - -# disable upgrading setup tools due to bug in setuptools and automation sdk -# once this is fixed, switch back to: pip3 install --upgrade pip setuptools -RUN cd /app && \ - pip3 install --upgrade pip && \ - pip3 install --force-reinstall 'setuptools==60.10.0' && \ - pip3 install -r requirements.txt && \ - pip3 install --upgrade git+https://github.com/vmware/vsphere-automation-sdk-python.git - # Run the application WORKDIR /app @@ -22,8 +11,20 @@ RUN set -eux; \ adduser --uid 1000 --ingroup netbox-sync --shell /bin/sh --home /home/netbox-sync --disabled-password \ --gecos "netbox-sync,0815,2342,9001" netbox-sync +# Prepare the application +COPY Dockerfile LICENSE.txt netbox-sync.py README.md requirements.txt settings-example.ini /app/ +COPY module /app/module + RUN chown -R netbox-sync:netbox-sync /app +# disable upgrading setup tools due to bug in setuptools and automation sdk +# once this is fixed, switch back to: pip3 install --upgrade pip setuptools +RUN cd /app && \ + pip3 install --upgrade pip && \ + pip3 install --force-reinstall 'setuptools==60.10.0' && \ + pip3 install -r requirements.txt && \ + pip3 install --upgrade git+https://github.com/vmware/vsphere-automation-sdk-python.git + USER netbox-sync ENTRYPOINT ["python3", "netbox-sync.py"] diff --git a/README.md b/README.md index fe4e589..e02e18c 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ usage: netbox-sync.py [-h] [-c settings.ini] Sync objects from various sources to NetBox -Version: 1.2.2 (2022-01-27) +Version: 1.2.3 (2022-04-09) Project URL: https://github.com/bb-ricardo/netbox-sync optional arguments: diff --git a/netbox-sync.py b/netbox-sync.py index d931143..88d2cac 100755 --- a/netbox-sync.py +++ b/netbox-sync.py @@ -25,8 +25,8 @@ from module.sources import instantiate_sources -__version__ = "1.2.2" -__version_date__ = "2022-01-27" +__version__ = "1.2.3" +__version_date__ = "2022-04-09" __author__ = "Ricardo Bartels " __description__ = "NetBox Sync" __license__ = "MIT" diff --git a/scripts/publish_docker.sh b/scripts/publish_docker.sh new file mode 100755 index 0000000..4a03737 --- /dev/null +++ b/scripts/publish_docker.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +IMAGE_NAME="bbricardo/netbox-sync" +IMAGE_TAG=$(grep "^__version__" netbox-sync.py | sed 's/__version__ = "\(.*\)"/\1/g') + +if [[ -z "$IMAGE_TAG" ]]; then + echo "ERROR: unable to grep version from 'netbox-sync.py'" + exit 1 +fi + +find . -name "__pycache__" -delete +docker build -t "${IMAGE_NAME}:${IMAGE_TAG}" . +docker tag "${IMAGE_NAME}:${IMAGE_TAG}" "${IMAGE_NAME}:latest" +docker push "${IMAGE_NAME}:${IMAGE_TAG}" +docker push "${IMAGE_NAME}:latest" + +docker-pushrm "$IMAGE_NAME"