Hereβs a quick update on what happened during the first session, we worked on a transforming someones current rockcraft.yaml
name: nbi
summary: An image for OSM NBI
description: |
OSM North Bound Interface image.
version: master_beta_3 # version format: <upstream-version>_<base-version>_<version>
license: Apache-2.0
base: ubuntu:22.04
platforms:
amd64:
services:
nbi:
override: replace
command: /usr/bin/python3.10 -m /app/osm_nbi.nbi
startup: enabled
user: appuser
group: appuser
parts:
non-root-user:
plugin: nil
overlay-script: |
chroot ${CRAFT_OVERLAY}
mkdir -p /app/osm_nbi
mkdir -p /app/storage/kafka
mkdir -p /app/log
groupadd -g 1000 appuser
useradd -u 1000 -g 1000 -d /app appuser
chown -R appuser:appuser /app
nbi:
after: [non-root-user]
plugin: python
source-type: git
source: https://osm.etsi.org/gerrit/osm/NBI
stage-packages:
- python3.10
build-packages:
- gcc
- git
- python3.10
- python3-dev
- python3-venv
- python3-pip
- python3-setuptools
- wget
override-build: |
pip install --upgrade pip
python3 -m pip install -U pip build
git clone -b master https://osm.etsi.org/gerrit/osm/common.git
git clone -b master https://osm.etsi.org/gerrit/osm/IM.git
python3 -m pip install --force-reinstall -r requirements.txt -r common/requirements.txt -r IM/requirements.txt --no-cache-dir
python3 -m build common && python3 -m pip install common/dist/*.whl
python3 -m build IM && python3 -m pip install IM/dist/*.whl
python3 -m build ${CRAFT_PART_BUILD} && python3 -m pip install ${CRAFT_PART_BUILD}/dist/*.whl
mkdir -p app/osm_nbi/html_public
cp -R /usr/local/lib/python3.10/dist-packages/osm_nbi/html_public app/osm_nbi/html_public
cp /usr/local/lib/python3.10/dist-packages/osm_nbi/nbi.cfg app/osm_nbi/
cp -R /usr/local/lib/python3.10/dist-packages/osm_nbi/http app/osm_nbi/
Into a more declarative one
name: nbi
summary: An image for OSM NBI
description: |
OSM North Bound Interface image.
version: master_beta_3 # version format: <upstream-version>_<base-version>_<version>
license: Apache-2.0
base: ubuntu:22.04
platforms:
amd64:
services:
nbi:
override: replace
command: /usr/bin/python3.10 -m /app/osm_nbi.nbi
startup: enabled
user: appuser
group: appuser
parts:
non-root-user:
plugin: nil
overlay-script: |
chroot ${CRAFT_OVERLAY}
mkdir -p /app/osm_nbi
mkdir -p /app/storage/kafka
mkdir -p /app/log
groupadd -g 1000 appuser
useradd -u 1000 -g 1000 -d /app appuser
chown -R appuser:appuser /app
common:
source: https://osm.etsi.org/gerrit/osm/common.git
plugin: python
python-requirements:
- requirements.txt
stage-packages:
- python3.10-venv
build-environment:
- PYTHONDONTWRITEBYTECODE: "1"
# Workaround for conflicts (Issue: ...)
override-build: |
craftctl default
find "$CRAFT_PART_INSTALL" -name '*.pyc' -exec rm {} \;
stage:
- -bin/activate
- -bin/activate.csh
- -bin/activate.fish
- -lib/python3.10/site-packages/pip-23.1.2.dist-info/RECORD
- -lib/python3.10/site-packages/wheel-0.40.0.dist-info/RECORD
im:
source: https://osm.etsi.org/gerrit/osm/IM.git
plugin: python
python-requirements:
- requirements.txt
stage-packages:
- python3.10-venv
build-environment:
- PYTHONDONTWRITEBYTECODE: "1"
# Workaround for conflicts (Issue: ...)
override-build: |
craftctl default
find "$CRAFT_PART_INSTALL" -name '*.pyc' -exec rm {} \;
stage:
- -bin/activate
- -bin/activate.csh
- -bin/activate.fish
- -lib/python3.10/site-packages/pip-23.1.2.dist-info/RECORD
- -lib/python3.10/site-packages/wheel-0.40.0.dist-info/RECORD
nbi:
source: https://osm.etsi.org/gerrit/osm/NBI.git
plugin: python
stage-packages:
- python3.10
build-packages:
- gcc
- git
- python3.10
- python3-dev
- python3-venv
- python3-pip
- python3-setuptools
- wget
organize:
lib/python3.10/site-packages/osm_nbi/nbi.cfg: app/osm_nbi/nbi.cfg
lib/python3.10/site-packages/html_public: app/osm_nbi/html_public
lib/python3.10/site-packages/http: app/osm_nbi/http