Skip to content

Commit

Permalink
Add containerization
Browse files Browse the repository at this point in the history
Signed-off-by: Rafael te Boekhorst <[email protected]>
Signed-off-by: Tobias Wolf <[email protected]>
Signed-off-by: Jan-Marten Brüggemann <[email protected]>
Co-authored-by: Tobias Wolf <[email protected]>
Co-authored-by: Jan-Marten Brüggemann <[email protected]>
  • Loading branch information
3 people authored Apr 29, 2024
1 parent 861d23a commit 5f34579
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 6 deletions.
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Builder
FROM python:3.11 as builder

ARG ROOKIFY_VERSION=0.0.0.dev0
ENV ROOKIFY_VERSION=$ROOKIFY_VERSION

WORKDIR /app/rookify

RUN pip install build
COPY . /app/rookify/
RUN python -m build /app/rookify/


# Base
FROM ubuntu:24.04 as base

# Update packages required for Rookify
RUN apt-get update && apt-get install -qy python3-pip-whl python3-rados python3-venv && apt-get clean

# Generate virtualenv including system packages with simlinks
RUN /usr/bin/python3 -m venv --system-site-packages /app/rookify/.venv


# Rookify
FROM base AS rookify
LABEL org.opencontainers.image.source="https://github.com/SovereignCloudStack/rookify"

ARG ROOKIFY_VERSION=0.0.0.dev0
ENV ROOKIFY_VERSION=$ROOKIFY_VERSION

WORKDIR /app/rookify

COPY --from=builder /app/rookify/dist/Rookify-${ROOKIFY_VERSION}-py3-none-any.whl ./src/
RUN .venv/bin/pip3 install ./src/Rookify-${ROOKIFY_VERSION}-py3-none-any.whl

# Set the ENTRYPOINT to activate the venv and then run the 'rookify' command
ENTRYPOINT [".venv/bin/rookify"]
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ RADOSLIB_VERSION := 2.0.0
GENERAL_LIB_LOCATION := $(shell pip show rados | grep -oP "(?<=Location: ).*")
RADOSLIB_INSTALLED_VERSION := $(shell pip show rados | grep Version | awk '{print $$2}')

## checking if docker, or podman should be used. Podman is preferred.
ifeq ($(shell command -v podman 2> /dev/null),)
CONTAINERCMD=docker
else
CONTAINERCMD=podman
endif

.PHONY: help
help: ## Display this help message
@echo -e '${COLOUR_RED}Usage: make <command>${COLOUR_END}'
Expand Down Expand Up @@ -56,7 +63,7 @@ run-local-rookify: ## Runs rookify in the local development environment (require
source ./.venv/bin/activate && \
cd src && python3 -m rookify

download-ceph-folder-from-testbed:
ssh testbed-node-0 'sudo cp -r /etc/ceph ~/ceph_configs && sudo chown -R $$USER:$$USER ~/ceph_configs'
scp -r testbed-node-0:ceph_configs ./.ceph
ssh testbed-node-0 'rm -rf ~/ceph_configs'
.PHONY: build-container
ROOKIFY_VERSION ?= 0.0.0.dev0
build-container: ## Build container from Dockerfile, add e.g. ROOKIFY_VERSION=0.0.1 to specify the version. Default value is 0.0.0.dev0
${CONTAINERCMD} build --build-arg ROOKIFY_VERSION=$(ROOKIFY_VERSION) -t rookify:latest -f Dockerfile .
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ cd rookify
make setup
```

4. __TODO:__ Install script for container-based setup
4. To install the container-based environment
```base
make build-container
```

## Usage
__TODO__
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_version() -> str:
:since: v0.0.1
"""

return os.environ.get("ROOKIFY_VERSION", "0.0.0-dev")
return os.environ.get("ROOKIFY_VERSION", "0.0.0.dev0")


_setup: Dict[str, Any] = {
Expand Down

0 comments on commit 5f34579

Please sign in to comment.