Skip to content

Commit

Permalink
fix: update version number outputting
Browse files Browse the repository at this point in the history
build: update docker image configuration

build: update uv installation into docker image

build: attempt fixing uv installation

build: add uv to path in docker image

build: try fixing PATH update in docker image

build: merge docker run instructions
  • Loading branch information
seppzer0 committed Jan 18, 2025
1 parent 7d13a4a commit 656108f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
20 changes: 9 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12-slim-bookworm AS base
FROM debian:bookworm-slim AS base

# variable store
ARG WDIR=/zero_build
Expand Down Expand Up @@ -29,20 +29,18 @@ RUN \
bison \
flex

# configure Python environment
RUN python3 -m pip install pip --upgrade && \
python3 -m pip install -r requirement-uv.txt && \
uv sync --frozen --no-install-project

# install shared tools from tools.json;
# install UV, .venv and shared tools;
#
# The idea here is that we pre-pack all the tools into the Docker/Podman image that can be used for any device:
# The main idea here is that we pre-pack all the tools into the Docker/Podman image that can be used for any device:
# (toolchains, binutils -- everything except device-specific kernel source);
#
# This significantly reduces the total build time, as each time we make a build call for a device,
# only device-specific kernel source is being downloaded into the container.
#
RUN uv run ${WDIR}/builder/utils/bridge.py --shared
RUN curl -LsSf https://astral.sh/uv/$(cat ./requirement-uv.txt | awk -F'==' '{print $2}' | tr -d ' \n')/install.sh | sh && \
. $HOME/.local/bin/env && \
uv sync --frozen --no-install-project && \
uv run ${WDIR}/builder/utils/bridge.py --shared

# launch app
CMD [ "/bin/bash" ]
# activate .venv
CMD [ "source", ".venv/bin/activate" ]
14 changes: 13 additions & 1 deletion builder/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@
from builder.commands import KernelCommand, AssetsCommand, BundleCommand


def __get_version() -> str:
"""Get app version."""
msg = "zero_kernel {}"

try:
return msg.format(version("zero-kernel"))
except Exception:
with open(Path(__file__).absolute().parents[1] / "pyproject.toml", "r") as f:
v = f.read().split('version = "')[1].split('"')[0]
return msg.format(v)


def parse_args() -> argparse.Namespace:
"""Parse the script arguments."""
# show the 'help' message if no arguments supplied
Expand All @@ -31,7 +43,7 @@ def parse_args() -> argparse.Namespace:
action="store_true",
help="clean the root directory"
)
parser_parent.add_argument("-v", "--version", action="version", version=version("zero-kernel"))
parser_parent.add_argument("-v", "--version", action="version", version=__get_version())

# common argument attributes for subparsers
help_base = "select a kernel base for the build"
Expand Down

0 comments on commit 656108f

Please sign in to comment.