-
Notifications
You must be signed in to change notification settings - Fork 21
Recompile requirements file used by Python in a container environment
Using Python requirements files is among Python development best practices. It dramatically reduces the need for managing and supervising different libraries. Managing your library dependencies from one place makes it easier, more convenient, and faster. It helps keep everything organized and easy for everyone involved.
It is a great way to ensure you have all the necessary dependencies installed for your project.
Also, GitHub provides automated vulnerability alerts for dependencies in your repository. By uploading a requirements.txt with your code, GitHub checks for any conflict and sends an alert to the administrator if it detects any. It can even resolve the vulnerabilities automatically!
If the conflicts in the requirements file could not be resolved automatically, or the base image version needs to be upgraded to a later version, or set to a different version, then the Python package requirements list can be recompiled by following the steps below.
Clone repository to your favourite directory on your test system.
# git clone https://github.com/IBM/ibm-spectrum-scale-bridge-for-grafana.git bridge_7.0.9-dev
Modify the base image version in the Dockerfile if required.
ARG BASE=registry.access.redhat.com/ubi9/ubi:9.2
Comment in the following rows
COPY ./requirements/requirements_ubi9.txt /root/requirements_ubi9.txt
# COPY ./requirements/requirements_ubi.in /root/requirements_ubi.in
RUN yum install -y python39 python3-pip
# RUN /usr/bin/python3 -m pip install pip-tools && \
# /usr/bin/python3 -m piptools compile /root/requirements_ubi.in --output-file /root/requirements_ubi9.txt && \
# echo "Compiled python packages: $(cat /root/requirements_ubi9.txt)"
RUN /usr/bin/python3 -m pip install -r /root/requirements_ubi9.txt && \
echo "Installed python version: $(/usr/bin/python3 -V)" && \
echo "Installed python packages: $(/usr/bin/python3 -m pip list)"
The dependencies in python packages will be recompiled, printed out and tested during the image build execution
# podman build -t scale_bridge:test_7.0.9_dev .
Verify the build process finished successfully. Copy "Compiled python packages:" section from the CLI output to a new requirements_ubiXXX.txt file. Store the file under /requirements. Comment out the previously embedded lines in the Dockerfile. Make sure the python packages install step in the Dockefile points to the new requirements file.
RUN /usr/bin/python3 -m pip install --user -r /root/requirements_ubiXXX.txt
Test image build again.
Visit the IBM Storage Scale Knowledge Center for getting more info about the latest product updates
-
- Setup classic Grafana
- Make usage of Grafana Provisioning feature
-
- Installing RedHat community-powered Grafana operator from OperatorHub
- Creating Grafana instance using the RedHat community-powered Grafana-operator
- Creating Grafana Datasorce instance from Custom Resource managed by the RedHat community powered Grafana operator
- Importing the predefined dashboard from the example dashboards collection
- Exploring Grafana WEB interface for CNSA project in a k8s OCP environment
- How to setup Grafana instance to monitor multiple IBM Storage Scale clusters running in a cloud or mixed environment
- API key authentication
- Configurable bridge settings
- CherryPy builtin HTTP server settings
- How to setup HTTPS(SSL) connection
- Start and stop grafana-bridge with systemd
- Grafana Dashboard Panel shows no metric values for a particular entity
- Missing Grafana-Operator on an OpenShift cluster
- Missing CherryPy packages
- What to do if your system is on Python < 3.8
- Grafana-bridge fails to start with Python3.8
- Grafana-bridge container time is different from a host time
- Verify that the grafana-bridge returns data as expected