Skip to content

Commit df77c60

Browse files
committed
initial
0 parents  commit df77c60

10 files changed

Lines changed: 288 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build and Push Multi-Folder to GHCR
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
packages: write
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Bump version and push tag
22+
id: tagger
23+
uses: mathieudutour/github-tag-action@v6.2
24+
with:
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
tag_prefix: "-v"
27+
28+
- name: Log in to GHCR
29+
uses: redhat-actions/podman-login@v1
30+
with:
31+
registry: ghcr.io
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Build Image
36+
id: build_image
37+
uses: redhat-actions/buildah-build@v2
38+
with:
39+
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
40+
tags: |
41+
${{ steps.tagger.outputs.new_tag }}
42+
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest
43+
latest
44+
context: .
45+
containerfiles: ./Dockerfile
46+
47+
- name: Push to GHCR
48+
uses: redhat-actions/push-to-registry@v2
49+
with:
50+
image: ${{ steps.build_image.outputs.image }}
51+
tags: ${{ steps.build_image.outputs.tags }}
52+
registry: ghcr.io/${{ github.repository_owner }}/{{ github.repository_name }}

.github/workflows/pr-check.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Pre-Merge Build Check
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
validate-build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Test Build (No Push)
17+
uses: redhat-actions/buildah-build@v2
18+
with:
19+
image: ${{ github.event.repository.name }}:latest-auto-testing
20+
context: .
21+
containerfiles: ./Dockerfile

CONTRIBUTORS.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Project Contributors
2+
3+
This file lists the individuals who have contributed to the OpenTech (R.A.) docker project.
4+
5+
## How to contribute
6+
* Reporting bugs
7+
* Suggesting enhancements
8+
* Submitting pull requests
9+
* Code style and conventions
10+
11+
## Develop / fix
12+
use git flow method
13+
14+
### Git Flow
15+
16+
This project utilizes `git-flow` for its branching model, which helps organize development and release cycles. Please adhere to the following `git-flow` conventions:
17+
18+
* **`main` Branch:** This branch contains the official release history. Only `release` and `hotfix` branches are merged into `main`.
19+
* **`develop` Branch:** This is the main development branch where all new features are integrated. `feature` branches are always merged into `develop`.
20+
* **`feature` Branches:** Use `git flow feature start <feature-name>` for new features. These branches should be based off `develop` and merged back into `develop`.
21+
* **`release` Branches:** Use `git flow release start <version>` when preparing a new release. These branches are based off `develop` and merged into both `main` and `develop`.
22+
* **`hotfix` Branches:** Use `git flow hotfix start <hotfix-name>` for urgent bug fixes on `main`. These branches are based off `main` and merged into both `main` and `develop`.
23+
24+
## How to push image
25+
26+
after developing you sould build
27+
```bash
28+
# Build
29+
podman build . -t offline-python-runtime-docker:dev-latest-local
30+
31+
# Create ghcr tag
32+
podman tag localhost/offline-python-runtime-docker:dev-latest-local \
33+
ghcr.io/opentechil/offline-python-runtime-docker:v-SOME-VER
34+
35+
# push
36+
podman push ghcr.io/opentechil/offline-python-runtime-docker:v-SOME-VER
37+
```
38+
## How to add yourself
39+
40+
If you've contributed to this project, please add your name and (optionally) your GitHub username or other contact information to this list.
41+
42+
Example:
43+
44+
* Your Name (@your-github-username)
45+
46+
## Current Contributors
47+
* Yehuda Korotkin (@alefbt)
48+

Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM python:3.13-slim-trixie
2+
3+
RUN apt-get update && apt-get install -y libaio1t64 libaio-dev unzip curl && rm -rf /var/lib/apt/lists/*
4+
5+
WORKDIR /opt/oracle
6+
7+
RUN curl -o instantclient-basic.zip https://download.oracle.com/otn_software/linux/instantclient/1929000/instantclient-basic-linux.x64-19.29.0.0.0dbru.zip && \
8+
unzip -o instantclient-basic.zip && \
9+
rm instantclient-basic.zip
10+
11+
RUN ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1
12+
13+
ENV LD_LIBRARY_PATH=/opt/oracle/instantclient_19_29:$LD_LIBRARY_PATH
14+
ENV ORACLE_HOME=/opt/oracle/instantclient_19_29
15+
ENV ORACLE_INSTANTCLIENT_PATH=/opt/oracle/instantclient_19_29
16+
17+
RUN useradd -m appuser
18+
RUN chown -R appuser /home/appuser
19+
20+
USER appuser
21+
22+
WORKDIR /home/appuser
23+
24+
RUN mkdir -p /home/appuser/.local/bin
25+
26+
COPY ./requirements.txt .
27+
28+
ENV PATH=/home/appuser/.local/bin:$PATH
29+
# If you want to download
30+
# RUN pip download -d ./packages -r requirements.txt
31+
# RUN pip install --no-index --find-links=./packages -r requirements.txt
32+
33+
RUN pip install --user -r requirements.txt
34+
35+
COPY --chown=appuser:appuser ./py-apps/ ./py-apps/
36+
37+
#RUN tests
38+
RUN pytest -v py-apps/tests/
39+
40+
41+
CMD ["python", "./py-apps/main.py"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 OpenTech (R.A.)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Offline Python Dockers Runtime
2+
for offline air gapped enviorment
3+
4+
## For Open Source Community
5+
6+
We welcome contributions from the open-source community to enhance Offline Python Dockers.
7+
8+
### Getting Started
9+
10+
To get started with OfflinePythonDockers, clone the repository and follow these steps:
11+
12+
1. **Clone the repository:**
13+
```bash
14+
git clone https://github.com/your-username/offline-python-runtime-docker.git
15+
cd offline-python-runtime-docker
16+
```
17+
2. **Build Docker images:**
18+
```bash
19+
podman build . -t offline-python-runtime-docker:dev-latest-local
20+
21+
3. **Run python**
22+
TL;DR:
23+
```bash
24+
podman run -v ./your-python-dir:/home/appuser/your-python-dir:Z \
25+
-it localhost:offline-python-runtime-docker:dev \
26+
python ./your-python-dir/file.py
27+
```
28+
29+
Full example:
30+
```bash
31+
# Create folder to share with docker
32+
mkdir -p ./your-python-dir
33+
34+
# Write a code
35+
echo 'print ("Hello world!")' > ./your-python-dir/file.py
36+
37+
# Run it
38+
podman run \
39+
-v ./your-python-dir:/home/appuser/your-python-dir:Z \
40+
-it localhost/offline-python-runtime-docker:dev \
41+
python ./your-python-dir/file.py
42+
43+
#output> Hello world!
44+
```
45+
46+
### Contributing
47+
48+
We encourage contributions! Please read our `CONTRIBUTING.md` (to be created) for guidelines on:
49+
* Reporting bugs
50+
* Suggesting enhancements
51+
* Submitting pull requests
52+
* Code style and conventions
53+
54+
### License
55+
This project is licensed under the MIT License. See the `LICENSE` file for details.

py-apps/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("TEST")

py-apps/tests/test_imports.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# check_imports.py
2+
import importlib
3+
import sys
4+
5+
# List the packages you want to verify
6+
packages = ["oracledb", "pytest"]
7+
8+
def test_verify_packages():
9+
missing = []
10+
for pkg in packages:
11+
try:
12+
importlib.import_module(pkg)
13+
print(f"✅ {pkg} loaded successfully.")
14+
15+
except ImportError:
16+
print(f"❌ {pkg} failed to load.")
17+
missing.append(pkg)
18+
19+
if missing:
20+
print(f"\nTotal missing/broken: {len(missing)}")
21+
sys.exit(1) # Exit with error to stop Docker build/run
22+
else:
23+
print("\nAll packages are healthy!")
24+
25+
if __name__ == "__main__":
26+
test_verify_packages()

py-apps/tests/test_thick_oracle.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import oracledb
2+
import sys
3+
import os
4+
5+
#/opt/oracle/instantclient_19_29
6+
oracle_instantclient_path = os.environ["ORACLE_INSTANTCLIENT_PATH"]
7+
8+
def test_env_var_is_set():
9+
assert oracle_instantclient_path
10+
11+
def test_verify_packages():
12+
try:
13+
oracledb.init_oracle_client(lib_dir=oracle_instantclient_path)
14+
except Exception as e:
15+
print(f"\n ❌ Error init oracle client - check the instantclient path \n\n ERR:\n{e}")
16+
sys.exit(1) # Exit with error to stop Docker build/run
17+
18+
if __name__ == "__main__":
19+
test_verify_packages()

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pandas
2+
cryptography
3+
oracledb
4+
pytest

0 commit comments

Comments
 (0)