Add initial infra
This commit is contained in:
parent
b2917e7e5d
commit
925f0c3ccd
7 changed files with 91 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,5 +1,6 @@
|
|||
.cproject
|
||||
.project
|
||||
.pydevproject
|
||||
.settings/
|
||||
/Debug/
|
||||
/build/
|
||||
|
|
26
infra/containers/README.md
Normal file
26
infra/containers/README.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
# Containers
|
||||
|
||||
This is a collection of CI-focused containers for testing.
|
||||
|
||||
# Setup
|
||||
|
||||
Install and run `podman` and activate the Rest API:
|
||||
|
||||
```bash
|
||||
sudo apt-get -y install podman
|
||||
podman system service -t 0 &
|
||||
```
|
||||
|
||||
# Build containers
|
||||
|
||||
```bash
|
||||
cd ubuntu/22_04/MinimalDeps
|
||||
podman build -t ubuntu_22_04_minimal_deps .
|
||||
```
|
||||
|
||||
# Run containers
|
||||
|
||||
```bash
|
||||
podman run -it -v $LOCAL_SOURCE_DIR:source ubuntu_22_04_minimal_deps:latest /bin/bash
|
||||
|
||||
```
|
2
infra/containers/ubuntu/22_04/MinimalDeps/Dockerfile
Normal file
2
infra/containers/ubuntu/22_04/MinimalDeps/Dockerfile
Normal file
|
@ -0,0 +1,2 @@
|
|||
FROM ubuntu:22.04
|
||||
RUN apt-get update; apt-get -y install build-essential pkg-config cmake
|
29
infra/src/ntk_infra/README.md
Normal file
29
infra/src/ntk_infra/README.md
Normal file
|
@ -0,0 +1,29 @@
|
|||
# ntk_infra
|
||||
|
||||
This is a collection of Python tools to support building the Notes Toolkit (NotesTK) project.
|
||||
|
||||
# Setup
|
||||
|
||||
Add `~/.local/bin` to `PATH`, i.e. in `~/.bashrc` add `export PATH=$PATH:~/.local/bin` and do `source ~/.bashrc`.
|
||||
|
||||
Set up virtual environment:
|
||||
|
||||
```bash
|
||||
sudo apt-get install python3-pip python3-venv
|
||||
python3 -m venv $MY_ENV_PATH
|
||||
source $MY_ENV_PATH/bin/activate
|
||||
```
|
||||
|
||||
When finished do:
|
||||
|
||||
```bash
|
||||
deactivate
|
||||
```
|
||||
|
||||
Install requirements:
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
|
0
infra/src/ntk_infra/__init__.py
Normal file
0
infra/src/ntk_infra/__init__.py
Normal file
32
infra/src/ntk_infra/podman_interface.py
Normal file
32
infra/src/ntk_infra/podman_interface.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
#import podman
|
||||
|
||||
"""Demonstrate PodmanClient."""
|
||||
import json
|
||||
from podman import PodmanClient
|
||||
|
||||
# Provide a URI path for the libpod service. In libpod, the URI can be a unix
|
||||
# domain socket(UDS) or TCP. The TCP connection has not been implemented in this
|
||||
# package yet.
|
||||
|
||||
uri = "unix:///run/user/1000/podman/podman.sock"
|
||||
|
||||
with PodmanClient(base_url=uri) as client:
|
||||
version = client.version()
|
||||
print("Release: ", version["Version"])
|
||||
print("Compatible API: ", version["ApiVersion"])
|
||||
print("Podman API: ", version["Components"][0]["Details"]["APIVersion"], "\n")
|
||||
|
||||
# get all images
|
||||
for image in client.images.list():
|
||||
print(image, image.id, "\n")
|
||||
|
||||
# find all containers
|
||||
for container in client.containers.list():
|
||||
first_name = container['Names'][0]
|
||||
container = client.containers.get(first_name)
|
||||
print(container, container.id, "\n")
|
||||
|
||||
# available fields
|
||||
print(sorted(container.attrs.keys()))
|
||||
|
||||
print(json.dumps(client.df(), indent=4))
|
1
infra/src/ntk_infra/requirements.txt
Normal file
1
infra/src/ntk_infra/requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
podman
|
Loading…
Reference in a new issue