From 802c2285ec9b17a7e3c0ae9f4763ab7082ce1287 Mon Sep 17 00:00:00 2001 From: Christopher Obbard <chris.obbard@collabora.com> Date: Mon, 7 Dec 2020 11:37:17 +0000 Subject: [PATCH] {image,flatpak}-builder: Install packaged version of debos The user-mode-linux support for debos has now been merged upstream, the packages have also been updated. Switch the builder images to use these new packaged versions rather than installing from source. Signed-off-by: Christopher Obbard <chris.obbard@collabora.com> --- flatdeb-builder/Dockerfile | 55 ++---------------------------- flatdeb-builder/bin/debos-wrapper | 13 ------- image-builder/Dockerfile | 56 ++----------------------------- image-builder/bin/debos-wrapper | 13 ------- 4 files changed, 5 insertions(+), 132 deletions(-) delete mode 100755 flatdeb-builder/bin/debos-wrapper delete mode 100755 image-builder/bin/debos-wrapper diff --git a/flatdeb-builder/Dockerfile b/flatdeb-builder/Dockerfile index c8e018e..9116dd3 100644 --- a/flatdeb-builder/Dockerfile +++ b/flatdeb-builder/Dockerfile @@ -2,41 +2,6 @@ ARG REGISTRY=registry.gitlab.apertis.org/infrastructure/apertis-docker-images ARG RELEASE ARG TAG=latest -# Build Debos from source to use the wip/uml fakemachine branch -# with the UML backend -FROM debian:buster-slim AS debos-builder -ENV DEBIAN_FRONTEND=noninteractive -ENV GOPATH=/usr/local/go -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - ca-certificates \ - gcc \ - git \ - golang-go \ - libc6-dev \ - libostree-dev && \ - rm -rf /var/lib/apt/lists/* -RUN go get -v -d github.com/go-debos/debos/cmd/debos -RUN git -C ${GOPATH}/src/github.com/go-debos/debos checkout -b uml d2ab9d3b08056c416bfbcd63c01199e14b2fc3b9 && \ - git -C ${GOPATH}/src/github.com/go-debos/fakemachine checkout wip/uml && \ - go install github.com/go-debos/debos/cmd/debos - -# Build the slirp helpers, needed by UML for unprivileged networking -FROM rust:1.42-slim-buster AS slirp-builder -RUN echo 'deb http://deb.debian.org/debian bullseye main' > /etc/apt/sources.list.d/debian-bullseye.list && \ - printf 'Package: *\nPin: release a=testing\nPin-Priority: 400\n' > /etc/apt/preferences.d/50-testing && \ - apt-get update && \ - apt-get install -y --no-install-recommends \ - git \ - libdbus-1-dev \ - libglib2.0-dev \ - libslirp-dev \ - pkg-config && \ - rm -rf /var/lib/apt/lists/* -RUN git clone https://gitlab.freedesktop.org/sjoerd/libslirp-rs -b wip/sjoerd/slirp-seq /tmp/libslirp-rs && \ - cd /tmp/libslirp-rs && \ - cargo install --all-features --verbose --path . --root /usr/local - # Build the main image FROM $REGISTRY/$RELEASE-base:$TAG ARG RELEASE @@ -47,7 +12,6 @@ ENV LC_ALL C.UTF-8 ENV HOME="/scratch" ENV DEBIAN_FRONTEND=noninteractive -ENV GOPATH=/usr/local/go # Need tmp to be somewhere we can write # It needs to be a tmpfs with exec enabled @@ -61,12 +25,14 @@ RUN apt-get update && \ binutils \ ca-certificates \ curl \ + debos \ devscripts \ elfutils \ flatpak \ flatpak-builder \ git \ libnss-wrapper \ + libslirp-helper \ linux-image-amd64 \ openssh-client \ ostree \ @@ -80,27 +46,10 @@ RUN apt-get update && \ qemu-utils \ qemu-user-static \ rsync \ - systemd-container \ time \ user-mode-linux \ udev -# Create /lib/modules as fakemachine will try to mount the uml modules at that -# location -RUN mkdir -p /lib/modules - -# FIXME: move to a packaged version -RUN apt-get update && \ - apt-get install --no-install-recommends -y busybox systemd-container debootstrap -ENV PATH=$PATH:/usr/local/go/bin -COPY bin/debos-wrapper /usr/bin/debos -COPY --from=debos-builder ${GOPATH}/bin/debos ${GOPATH}/bin/debos.real - -# FIXME: move to a packaged version -RUN apt-get update && \ - apt-get install -y --no-install-recommends libslirp0 -COPY --from=slirp-builder /usr/local/bin/* /usr/local/bin/ - # FIXME: move to a packaged version RUN git clone --branch apertis/$RELEASE --depth 1 https://gitlab.apertis.org/infrastructure/apertis-flatdeb.git /opt/apertis-flatdeb diff --git a/flatdeb-builder/bin/debos-wrapper b/flatdeb-builder/bin/debos-wrapper deleted file mode 100755 index 235abd6..0000000 --- a/flatdeb-builder/bin/debos-wrapper +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -set -e - -if [ -f /tmp/libslirp ]; then - rm /tmp/libslirp -fi - -slirp-seq --listen-seqsocket-path=/tmp/libslirp \ - --exit-with-parent & - - -exec debos.real "$@" diff --git a/image-builder/Dockerfile b/image-builder/Dockerfile index c01bf87..03ed152 100644 --- a/image-builder/Dockerfile +++ b/image-builder/Dockerfile @@ -2,41 +2,6 @@ ARG REGISTRY=registry.gitlab.apertis.org/infrastructure/apertis-docker-images ARG RELEASE ARG TAG=latest -# Build Debos from source to use the wip/uml fakemachine branch -# with the UML backend -FROM debian:buster-slim AS debos-builder -ENV DEBIAN_FRONTEND=noninteractive -ENV GOPATH=/usr/local/go -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - ca-certificates \ - gcc \ - git \ - golang-go \ - libc6-dev \ - libostree-dev && \ - rm -rf /var/lib/apt/lists/* -RUN go get -v -d github.com/go-debos/debos/cmd/debos -RUN git -C ${GOPATH}/src/github.com/go-debos/debos checkout -b uml d2ab9d3b08056c416bfbcd63c01199e14b2fc3b9 && \ - git -C ${GOPATH}/src/github.com/go-debos/fakemachine checkout wip/uml && \ - go install github.com/go-debos/debos/cmd/debos - -# Build the slirp helpers, needed by UML for unprivileged networking -FROM rust:1.42-slim-buster AS slirp-builder -RUN echo 'deb http://deb.debian.org/debian bullseye main' > /etc/apt/sources.list.d/debian-bullseye.list && \ - printf 'Package: *\nPin: release a=testing\nPin-Priority: 400\n' > /etc/apt/preferences.d/50-testing && \ - apt-get update && \ - apt-get install -y --no-install-recommends \ - git \ - libdbus-1-dev \ - libglib2.0-dev \ - libslirp-dev \ - pkg-config && \ - rm -rf /var/lib/apt/lists/* -RUN git clone https://gitlab.freedesktop.org/sjoerd/libslirp-rs -b wip/sjoerd/slirp-seq /tmp/libslirp-rs && \ - cd /tmp/libslirp-rs && \ - cargo install --all-features --verbose --path . --root /usr/local - # Build the main image FROM $REGISTRY/$RELEASE-base:$TAG ENV LANG=C.UTF-8 @@ -46,7 +11,6 @@ ENV LC_ALL C.UTF-8 ENV HOME="/scratch" ENV DEBIAN_FRONTEND=noninteractive -ENV GOPATH=/usr/local/go # Need tmp to be somewhere we can write # It needs to be a tmpfs with exec enabled @@ -64,6 +28,7 @@ RUN apt-get update && \ ca-certificates \ cryptsetup \ curl \ + debos \ device-tree-compiler \ devscripts \ dosfstools \ @@ -73,6 +38,8 @@ RUN apt-get update && \ jq \ kmod \ libnss-wrapper \ + libslirp-helper \ + linux-image-amd64 \ lqa \ mtd-utils \ openssh-client \ @@ -84,27 +51,10 @@ RUN apt-get update && \ qemu-utils \ qemu-user-static \ rsync \ - systemd-container \ user-mode-linux \ u-boot-tools \ udev -# Create /lib/modules as fakemachine will try to mount the uml modules at that -# location -RUN mkdir -p /lib/modules - -# FIXME: move to a packaged version -RUN apt-get update && \ - apt-get install --no-install-recommends -y busybox systemd-container debootstrap -ENV PATH=$PATH:/usr/local/go/bin -COPY bin/debos-wrapper /usr/bin/debos -COPY --from=debos-builder ${GOPATH}/bin/debos ${GOPATH}/bin/debos.real - -# FIXME: move to a packaged version -RUN apt-get update && \ - apt-get install -y --no-install-recommends libslirp0 -COPY --from=slirp-builder /usr/local/bin/* /usr/local/bin/ - # Defer libnss-unknown package installation to the end to avoid possible UID/GID problems RUN apt-get update && \ apt-get install --no-install-recommends -y libnss-unknown diff --git a/image-builder/bin/debos-wrapper b/image-builder/bin/debos-wrapper deleted file mode 100755 index 235abd6..0000000 --- a/image-builder/bin/debos-wrapper +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -set -e - -if [ -f /tmp/libslirp ]; then - rm /tmp/libslirp -fi - -slirp-seq --listen-seqsocket-path=/tmp/libslirp \ - --exit-with-parent & - - -exec debos.real "$@" -- GitLab