-
Notifications
You must be signed in to change notification settings - Fork 74
vm-less and daemon-less ELBE build via container #482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
be69ac8
76f1917
a81cea7
54c6114
4a31760
e398761
1edb61c
c3359a1
3793bb6
5b96212
d05b203
511b2ae
7200369
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| .git | ||
| .mypy_cache | ||
| .pytest_cache | ||
| *.deb | ||
| *.buildinfo | ||
| *.changes |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would anybody really stick to the vmfull container?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Honestly, I tried, but am unable to understand what the contrib/containerfile/Containerfile is actually used for. So I did not want to break anyones obscure use case. But if that is fine for you, I am happy to drop that and replace it with my Containerfile.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we avoid the whole container thing for now and just do the root-less builds from an ELBE source checkout?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In principle, yes. But that requires the system to be set up exactly as ELBE requires it. Not sure if that is really feasible.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It now replaces the previous containerfile |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # ELBE - Debian Based Embedded Rootfilesystem Builder | ||
| # SPDX-License-Identifier: GPL-3.0-or-later | ||
| # SPDX-FileCopyrightText: 2026 Linutronix GmbH | ||
|
|
||
| FROM debian:trixie-slim | ||
|
|
||
| USER root | ||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| RUN apt-get update -y && \ | ||
| apt-get upgrade -y && \ | ||
| apt-get install -y --no-install-recommends \ | ||
| ca-certificates \ | ||
| elbe-archive-keyring \ | ||
| tini | ||
|
|
||
| RUN echo 'deb [signed-by=/usr/share/keyrings/elbe-archive-keyring.gpg] http://debian.linutronix.de/elbe bullseye main' \ | ||
| > /etc/apt/sources.list.d/elbe.list && \ | ||
| apt-get update -y && \ | ||
| apt-get install -y --no-install-recommends \ | ||
| python3-elbe-daemon \ | ||
| python3-elbe-soap \ | ||
| python3-elbe-control \ | ||
| locales && \ | ||
| apt-get clean -y | ||
|
|
||
| RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen | ||
|
|
||
| VOLUME [ "/build" ] | ||
|
|
||
| USER root | ||
| WORKDIR /build | ||
|
|
||
| COPY entrypoint.sh /entrypoint.sh | ||
| RUN chmod +x /entrypoint.sh | ||
|
|
||
| # Use tini for reaping child processes. | ||
| ENTRYPOINT ["tini", "--", "/entrypoint.sh"] |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # ELBE - Debian Based Embedded Rootfilesystem Builder | ||
| # SPDX-License-Identifier: GPL-3.0-or-later | ||
| # SPDX-FileCopyrightText: 2026 Linutronix GmbH | ||
|
|
||
| FROM debian:trixie-slim AS builder | ||
|
|
||
| USER root | ||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| RUN apt-get update -y && \ | ||
| apt-get install -y --no-install-recommends \ | ||
| build-essential \ | ||
| ca-certificates | ||
|
|
||
| WORKDIR /usr/src/elbe | ||
| COPY . . | ||
|
|
||
| RUN apt-get update -y && \ | ||
| apt-get build-dep -y . && \ | ||
| DEB_BUILD_OPTIONS=nocheck sphinxflags= dpkg-buildpackage -us -uc -b && \ | ||
| mkdir -p /out && mv ../*.deb /out/ | ||
|
|
||
| FROM debian:trixie-slim | ||
|
|
||
| USER root | ||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| RUN apt-get update -y && \ | ||
| apt-get install -y --no-install-recommends \ | ||
| ca-certificates \ | ||
| tini | ||
|
|
||
| COPY --from=builder /out/*.deb /tmp/local-debs/ | ||
| RUN apt-get update -y && apt-get upgrade -y | ||
|
|
||
| RUN apt-get install -y --no-install-recommends \ | ||
| locales \ | ||
| /tmp/local-debs/elbe-schema_*.deb \ | ||
| /tmp/local-debs/python3-elbe-common_*.deb \ | ||
| /tmp/local-debs/python3-elbe-bin_*.deb \ | ||
| /tmp/local-debs/python3-elbe-buildenv_*.deb \ | ||
| /tmp/local-debs/python3-elbe-daemon_*.deb \ | ||
| /tmp/local-debs/python3-elbe-soap_*.deb \ | ||
| /tmp/local-debs/python3-elbe-control_*.deb && \ | ||
| rm -rf /tmp/local-debs && \ | ||
| apt-get clean -y | ||
|
|
||
| RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen | ||
|
|
||
| VOLUME [ "/build" ] | ||
|
|
||
| USER root | ||
| WORKDIR /build | ||
|
|
||
| COPY contrib/containerfile/entrypoint.sh /entrypoint.sh | ||
| RUN chmod +x /entrypoint.sh | ||
|
|
||
| # Use tini for reaping child processes. | ||
| ENTRYPOINT ["tini", "--", "/entrypoint.sh"] |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #!/bin/sh | ||
| # SPDX-License-Identifier: GPL-3.0-or-later | ||
| # SPDX-FileCopyrightText: 2026 Linutronix GmbH | ||
| set -e | ||
|
|
||
| # Check if we already have CAP_SYS_ADMIN | ||
| # In that case we assume we are already running rootful, | ||
| # so no need for unshare, but this mode also enables usage | ||
| # of loop devices, so perform mknod to enable its usage. | ||
| capeff=$(grep '^CapEff:' /proc/self/status | cut -f2) | ||
| if [ $(( 0x$capeff & 0x200000 )) -ne 0 ]; then | ||
| i=0 | ||
| while [ "$i" -lt 64 ]; do | ||
| [ -e "/dev/loop$i" ] || mknod -m 660 "/dev/loop$i" b 7 "$i" 2>/dev/null || true | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we mount devtmpfs instead here, too?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar reason as #482 (comment)
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough. I'll have to play around with this actually.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well... So it is working, but maybe not in the "modern" way. I guess I should pass through /dev/loop-control as well? |
||
| i=$((i + 1)) | ||
| done | ||
| exec "$@" | ||
| fi | ||
|
|
||
| exec unshare --user --map-root-user --map-users=all --map-groups=all --mount -- "$@" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is quite specific to Debian, let me think about something more generic.