Skip to content

Commit

Permalink
Add Python image README
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrevicenzi committed May 30, 2024
1 parent a8b32d6 commit 8529386
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bci_build/package/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _get_python_kwargs(py3_ver: _PYTHON_VERSIONS, os_version: OsVersion):

kwargs = {
"name": "python",
"pretty_name": f"Python {py3_ver} development",
"pretty_name": f"Python {py3_ver} Development",
"version": py3_ver,
"additional_versions": ["3"],
"env": {
Expand Down
57 changes: 57 additions & 0 deletions src/bci_build/package/python/README.md.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# {{ image.pretty_name }} Container Image

{% include 'badges.j2' %}

## Description

[Python](https://www.python.org/) is an interpreted, interactive, object-oriented, open-source programming language. It incorporates modules, exceptions, dynamic typing, high-level dynamic data types, and classes. It provides interfaces to many system calls, libraries, and various window systems, and it is extensible in C or C++. It is also usable as an extension language for applications that require programmable interfaces.

## Usage

To deploy an application, install dependencies, copy the sources, and configure the application's main script:

```Dockerfile
FROM {{ image.pretty_reference }}

WORKDIR /app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD [ "python", "./main-script.py" ]
```

Build and run the container image:

```ShellSession
$ podman build -t my-python-app .
$ podman run -it --rm my-python-app
```

To run a single script inside a container, use the following command:

```ShellSession
$ podman run --rm -v "$PWD":/app:Z -w /app {{ image.pretty_reference }} python3 script.py
```

## Additional tools

The following tools are included in the image:

{% set has_pipx = image.is_opensuse or (image.os_version.is_sle15 and image.version == '3.11') -%}
{% set has_wheel = image.is_opensuse or (image.os_version.is_sle15 and image.version == '3.6') -%}

- python{{ image.version }}-devel
- python{{ image.version }}-pip
{% if has_pipx -%}
- python{{ image.version }}-pipx
{% endif -%}
{% if has_wheel -%}
- python{{ image.version }}-wheel
{% endif -%}
- curl
- git-core

{% include 'licensing_and_eula.j2' %}

0 comments on commit 8529386

Please sign in to comment.