diff --git a/deployment/.env b/deployment/.env index f4bc570..1556847 100644 --- a/deployment/.env +++ b/deployment/.env @@ -1,2 +1,3 @@ PROJECT_NAME=pyinventory -PYTHON_PACKAGE_NAME=inventory +PROJECT_PACKAGE_NAME=pyinventory +PROJECT_VERSION=0.7.0rc1 diff --git a/deployment/Dockerfile b/deployment/Dockerfile index 840e68c..333fdb8 100644 --- a/deployment/Dockerfile +++ b/deployment/Dockerfile @@ -1,5 +1,5 @@ -FROM python:3.9-slim-buster # https://hub.docker.com/_/python +FROM python:3.9-slim-buster # for pip cache: ENV XDG_CACHE_HOME=/var/cache @@ -7,7 +7,8 @@ ENV XDG_CACHE_HOME=/var/cache ENV PYTHONUNBUFFERED=1 # Install deps -RUN apt-get update \ +RUN set -x \ + && apt-get update \ && apt-mark auto $(apt-mark showinstall) \ && apt-get install -y postgresql-client-11 python3-pip \ && apt autoremove \ @@ -16,11 +17,21 @@ RUN apt-get update \ && python3 -m pip install -U pip \ && pip install -U psycopg2-binary -RUN addgroup --system django \ +# Create user for application server: +RUN set -x \ + && addgroup --system django \ && adduser --system --no-create-home --disabled-password --ingroup django --shell /bin/bash django WORKDIR /django -RUN pip install "pyinventory>=0.6.0" +ARG PROJECT_PACKAGE_NAME +ENV PROJECT_PACKAGE_NAME=${PROJECT_PACKAGE_NAME} + +ARG PROJECT_VERSION +ENV PROJECT_VERSION=${PROJECT_VERSION} + +# Install project: +RUN set -x \ + && pip install "${PROJECT_PACKAGE_NAME}>=${PROJECT_VERSION}" diff --git a/deployment/django/entrypoint.sh b/deployment/django/entrypoint.sh index 8f50543..13d4c9c 100755 --- a/deployment/django/entrypoint.sh +++ b/deployment/django/entrypoint.sh @@ -26,7 +26,7 @@ if [ -d "/dist/" ] ; then else ( set -x - pip3 install -U "${PYTHON_PACKAGE_NAME}" + pip3 install -U "${PROJECT_PACKAGE_NAME}>=${PROJECT_VERSION}" ) fi diff --git a/deployment/docker-compose.yml b/deployment/docker-compose.yml index be502c4..d86d799 100644 --- a/deployment/docker-compose.yml +++ b/deployment/docker-compose.yml @@ -21,6 +21,9 @@ services: build: context: . dockerfile: Dockerfile + args: + - PROJECT_PACKAGE_NAME=${PROJECT_PACKAGE_NAME} + - PROJECT_VERSION=${PROJECT_VERSION} restart: unless-stopped hostname: django ports: diff --git a/pyproject.toml b/pyproject.toml index 2366f22..6888d52 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "PyInventory" -version = "0.7.0" +version = "0.7.0rc1" description = "Web based management to catalog things including state and location etc. using Python/Django." authors = ["JensDiemer "] packages = [ diff --git a/src/inventory/__init__.py b/src/inventory/__init__.py index 6ba40bf..7ccbaaa 100644 --- a/src/inventory/__init__.py +++ b/src/inventory/__init__.py @@ -4,7 +4,7 @@ :license: GNU GPL v3 or above, see LICENSE for more details. """ -__version__ = "0.7.0" +__version__ = "0.7.0rc1" # https://docs.djangoproject.com/en/2.0/ref/applications/#configuring-applications-ref default_app_config = "inventory.apps.InventoryConfig" diff --git a/src/inventory_project/tests/test_project_setup.py b/src/inventory_project/tests/test_project_setup.py index e38376a..a7961a3 100644 --- a/src/inventory_project/tests/test_project_setup.py +++ b/src/inventory_project/tests/test_project_setup.py @@ -46,6 +46,11 @@ def test_version(package_root=None, version=None): string=f'version = "{version}"' ) + assert_file_contains_string( + file_path=Path(package_root, 'deployment', '.env'), + string=f'PROJECT_VERSION={version}' + ) + def test_poetry_check(package_root=None): if package_root is None: