diff --git a/.gitignore b/.gitignore index e4bf442..d8dd9a3 100644 --- a/.gitignore +++ b/.gitignore @@ -88,4 +88,4 @@ cython_debug/ # Project specific data.yaml config.yaml -.ceph \ No newline at end of file +.ceph diff --git a/Dockerfile b/Dockerfile index af3bb37..1977a74 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,29 +12,18 @@ RUN python -m build /app/rookify/ # Base -FROM debian:stable-slim as base +From quay.io/ceph/ceph:v17.2.7 as base COPY requirements.txt /app/rookify/src/ # Install Librados: # Get rados version from requirements.txt and install it using apt, # because librados does not exist as pip package -RUN apt-get update && apt-get install -y python3-pip python3-rados python3-venv && \ - # Save the path to PKG-INFO file to a variable - PKG_INFO_PATH=$(dpkg -L python3-rados | grep -E '/rados-[0-9.]+\.egg-info/PKG-INFO') && \ - # Extract the installed version from the PKG-INFO file - INSTALLED_VERSION=$(grep -oP '(?<=Version: )\d+\.\d+\.\d+' "$PKG_INFO_PATH") && \ - # Extract the required version from the requirements.txt file - REQUIRED_VERSION=$(grep -oP '(?<=rados==)\d+\.\d+\.\d+' /app/rookify/src/requirements.txt) && \ - # Check if the installed version matches the required version, if not than give a warning and exit process - if [ "$INSTALLED_VERSION" != "$REQUIRED_VERSION" ]; then \ - echo "WARNING: Installed version of rados Python package ($INSTALLED_VERSION) does not match required version ($REQUIRED_VERSION)." >&2; \ - exit 1; \ - fi - -# Install package with requirements including systempackages and simlinks (rados) into a venv -RUN python3 -m venv --system-site-packages --symlinks /app/rookify/ && \ - /app/rookify/bin/pip install -r /app/rookify/src/requirements.txt +RUN cat /etc/os-release && dnf install -y python39-pip python3-virtualenv + +# Install package with requirements including systempackages with simlinks +RUN /usr/bin/python3.9 -m venv --system-site-packages /app/rookify/.venv && \ + /app/rookify/.venv/bin/pip3.9 install --ignore-installed -r /app/rookify/src/requirements.txt # Rookify FROM base AS rookify @@ -44,10 +33,10 @@ ARG ROOKIFY_VERSION=0.0.1 WORKDIR /app/rookify COPY --from=builder /app/rookify/dist/Rookify-${ROOKIFY_VERSION}-py3-none-any.whl ./src/ -RUN ./bin/pip install ./src/Rookify-${ROOKIFY_VERSION}-py3-none-any.whl +RUN .venv/bin/pip3.9 install ./src/Rookify-${ROOKIFY_VERSION}-py3-none-any.whl # This is for debugging and will not be used when ENTRYPOINT is set CMD ["sleep", "infinity"] # Set the ENTRYPOINT to activate the venv and then run the 'rookify' command -ENTRYPOINT ["/bin/bash", "-c", "source ./bin/activate && exec python -m rookify"] +ENTRYPOINT ["/app/rookify/bin/rookify"] diff --git a/Makefile b/Makefile index 6f2e83d..51b797d 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ help: ## Display this help message .PHONY: setup setup: ## Setting up the docker-compose environment ${MAKE} setup-venv - + setup-venv: python -m venv ./.venv source ./.venv/bin/activate @@ -41,15 +41,6 @@ setup-venv: pip install -r requirements.txt .PHONY: build-container -TAG ?= 0.0.1 +ROOKIFY_VERSION ?= 0.0.1 build-container: ## Build container from Dockerfile, add e.g. TAG=0.0.0.1 to specify the version. Default value is 0.0.0-dev - ${CONTAINERCMD} build --build-arg ROOKIFY_VERSION=$(TAG) -t rookify:latest -f Dockerfile . - -.PHONY: run-rookify-from-container -run-rookify-from-container: ## Run rookify from the container (Note: the ceph volume needs to be set correctly) - ${CONTAINERCMD} run -v ./src/config.yaml:/app/rookify/config.yaml:Z -v ./.ceph:/.ceph:Z rookify:latest - -.PHONY: run-interactive-container -run-interactive-container: ## Run an insteractive container (make sure that Dockerfile has the DEBBUGING sleep command set at the end) - ${CONTAINERCMD} run -it rookify:latest bash - + ${CONTAINERCMD} build --build-arg ROOKIFY_VERSION=$(ROOKIFY_VERSION) -t rookify:latest -f Dockerfile . diff --git a/pyproject.toml b/pyproject.toml index 63a7d09..7703e12 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,4 +3,9 @@ requires = [ "setuptools", "wheel" ] build-backend = "setuptools.build_meta" [project] +name = "Rookify" +version = "0.0.1" requires-python = ">=3.9" +readme = "README.md" +description = "Migration tool" +license.file = "LICENSE" diff --git a/requirements.txt b/requirements.txt index e23bdf7..9de726f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,7 +19,6 @@ pycparser==2.21 PyNaCl==1.5.0 python-dateutil==2.8.2 PyYAML==6.0.1 -rados==2.0.0 requests==2.31.0 requests-oauthlib==1.3.1 rsa==4.9