Add initial infra

This commit is contained in:
James Grogan 2022-11-30 13:45:59 +00:00
parent b2917e7e5d
commit 925f0c3ccd
7 changed files with 91 additions and 0 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
.cproject .cproject
.project .project
.pydevproject
.settings/ .settings/
/Debug/ /Debug/
/build/ /build/

View 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
```

View file

@ -0,0 +1,2 @@
FROM ubuntu:22.04
RUN apt-get update; apt-get -y install build-essential pkg-config cmake

View 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
```

View file

View 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))

View file

@ -0,0 +1 @@
podman