Skip to content

Add CI workflow and Containerfile for container image build#1

Open
omkarjoshi0304 wants to merge 5 commits intoopenstack-lightspeed:mainfrom
omkarjoshi0304:OSPRH-25519
Open

Add CI workflow and Containerfile for container image build#1
omkarjoshi0304 wants to merge 5 commits intoopenstack-lightspeed:mainfrom
omkarjoshi0304:OSPRH-25519

Conversation

@omkarjoshi0304
Copy link

@omkarjoshi0304 omkarjoshi0304 commented Feb 10, 2026

Adds CI pipeline to build and push the container image to quay.io.

  • On PR: builds the image (no push)
  • On merge to main: builds and pushes to quay.io
  • Image tags: v0.1.0- and latest
  • [Build Image](podman pull quay.io/rh-ee-ojoshi/openstack-ls-mcp)

Copy link

@lpiwowar lpiwowar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of things that crossed my mind while going through this for the first time:). Good start in a short time IMO! 🎉 👍

Containerfile Outdated
# Install the project and its dependencies
RUN pip install --no-cache-dir .

# Use the console_scripts entry point defined in pyproject.toml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (blocking): Let's add default user other than root.

Containerfile Outdated
COPY src/ src/

# Install the project and its dependencies
RUN pip install --no-cache-dir .

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (blocking): Let's use pdm to install the dependencies here (pip install ignores the lockfile).

Containerfile Outdated
# Install the project and its dependencies
RUN pip install --no-cache-dir .

# Use the console_scripts entry point defined in pyproject.toml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (blocking): Let's add EXPOSE for docs purposes.


steps:
- name: Checkout
uses: actions/checkout@v4

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (blocking): Let's use the latest version from -> https://github.com/actions/checkout

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed it to checkout@v6

Containerfile Outdated
# NOTE: UBI9 does not yet provide a Python 3.13 image (only up to 3.12).
# Since pyproject.toml requires python >= 3.13, we use the official Python
# slim image. Switch to a UBI-based image when one becomes available.
FROM python:3.13-slim

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (blocking): Let's use full URL here.

uses: redhat-actions/buildah-build@v2
with:
image: ${{ github.event.repository.name }}
tags: v${{ env.VERSION }} latest

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (blocking): Different people, different opinions:). But for now, I would follow the same pattern we use with the openstack-lightspeed/rag-content image. Use a commit hash only for the tag.

Containerfile Outdated
# NOTE: UBI9 does not yet provide a Python 3.13 image (only up to 3.12).
# Since pyproject.toml requires python >= 3.13, we use the official Python
# slim image. Switch to a UBI-based image when one becomes available.
FROM python:3.13-slim
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change it to python 3.12 so we can use the UBI9 image

# Since pyproject.toml requires python >= 3.13, we use the official Python
# slim image. Switch to a UBI-based image when one becomes available.
FROM python:3.13-slim

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# Install the project and its dependencies
RUN pip install --no-cache-dir .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should define a user and the workdir.
Reference: https://github.com/openstack-k8s-operators/cinder-operator/blob/main/Dockerfile

@omkarjoshi0304 omkarjoshi0304 force-pushed the OSPRH-25519 branch 2 times, most recently from d7d643b to fe38070 Compare February 11, 2026 16:36
Copy link

@lpiwowar lpiwowar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of things that need to be polished IMO:)

]
dependencies = ["mcp>=1.25.0", "openstackclient==4.0.0", "stevedore>=5.6.0", "pydantic>=2.12.5", "kubernetes>=35.0.0"]
requires-python = "==3.12"
requires-python = ">=3.12"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question (blocking): Why did you make this change? 👀 Also:

[lpiwowar@fedora rhos-mcps (OSPRH-25519)]$ pdm lock --check
WARNING: Lockfile hash doesn't match pyproject.toml, packages may be outdated

and

...
STEP 7/11: RUN pdm install --prod --no-editable --frozen-lockfile
WARNING: Lockfile hash doesn't match pyproject.toml, packages may be outdated
WARNING: Project requires a python version of >=3.12, The virtualenv is being created for you as it cannot be matched to the right version.
...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original requires-python was "==3.12", which means exactly Python 3.12.0. The UBI9 base image ships Python 3.12.12. Since 3.12.12 != 3.12.0, pdm treated them as incompatible and tried to download a separate CPython 3.12.0 during the container build, which failed. Changed to >=3.12 so it accepts any Python 3.12.x (including the 3.12.12 in the UBI9 image) and future versions.

Regarding the lockfile mismatch — you're right, the pdm.lock in this PR is stale. I'll regenerate it with pdm lock and push an updated commit.

Containerfile Outdated
# Copy dependency and build files first for better layer caching
COPY pyproject.toml pdm.lock README.md ./

# Copy the source code

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit (non-blocking): These types of comments are not necessary. Nothing too complicated is happening here, hence no need to explain it:). I would rethink whether the other comments are really necessary in the containerfile as well.

@@ -0,0 +1,32 @@
FROM registry.access.redhat.com/ubi9/python-312:latest

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (blocking): Short section in the readme about how to use the image could be nice:). No need to write the entire README. I think Gorka is working on this. For example, the REAMDE section can explain how can I use the image with custom configuration.


### Running the image
```bash
podman run -p 8080:8080 quay.io/openstack-lightspeed/rhos-mcps:latest

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: What if I want to use custom config.yaml file for the mcp server? [1]

[1] https://github.com/openstack-lightspeed/rhos-mcps/blob/main/config.yaml.sample

http://localhost:8080/mcp
```

### IDE configuration

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (non-blocking): I personally would not put this here since this is about the consumption of the MCP. The users of this MCP should consult with the documentation from their IDEs IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants