Skip to content

Commit

Permalink
Add additional configuration
Browse files Browse the repository at this point in the history
Tmpfiles.d entry to create default subuid/subid and podman configs, and systemd
units for dbus user session.
  • Loading branch information
jepio committed Apr 27, 2022
1 parent ad9488e commit 8f0c2f0
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,22 @@ CMD ["/bin/bash"]
RUN emerge-gitclone
RUN echo 'FEATURES="-network-sandbox -pid-sandbox -ipc-sandbox -usersandbox -sandbox"' >>/etc/portage/make.conf
COPY repos.conf /etc/portage/repos.conf/podman.conf
COPY . /var/lib/portage/podman-overlay/
COPY overlay /var/lib/portage/podman-overlay/

FROM base AS builder
RUN emerge -j4 --getbinpkg --autounmask-write --autounmask-continue --onlydeps podman
RUN emerge -j4 --getbinpkg --buildpkgonly podman
RUN emerge --root=/work --nodeps --usepkgonly podman
RUN emerge -j4 --getbinpkg --buildpkgonly podman squashfs-tools

FROM base AS staging
COPY --from=builder /var/lib/portage/pkgs /var/lib/portage/pkgs
RUN emerge --getbinpkg --usepkg squashfs-tools
RUN pkgs=$(emerge 2>/dev/null --usepkgonly --pretend podman | awk -F'] ' '/binary/{ print $ 2 }' | awk '{ print "="$1 }'); emerge --usepkgonly --root=/work --nodeps $pkgs
RUN mkdir -p /work/usr/lib/extension-release.d && echo -e 'ID=flatcar\nSYSEXT_LEVEL=1.0' >/work/usr/lib/extension-release.d/extension-release.podman
RUN mkdir -p /work/usr/src
RUN mv /work/etc /work/usr/etc
COPY usr /work/usr
RUN mkdir -p /output && mksquashfs /work /output/podman.raw -noappend

FROM busybox
COPY --from=builder /output /output
COPY --from=staging /output /output
CMD ["cp", "/output/podman.raw", "/out"]
1 change: 1 addition & 0 deletions usr/etc/subgid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
core:100000:65536
1 change: 1 addition & 0 deletions usr/etc/subuid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
core:100000:65536
8 changes: 8 additions & 0 deletions usr/lib/systemd/user/dbus.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Unit]
Description=D-Bus User Message Bus
Documentation=man:dbus-daemon(1)
Requires=dbus.socket

[Service]
ExecStart=/usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
ExecReload=/usr/bin/dbus-send --print-reply --session --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig
6 changes: 6 additions & 0 deletions usr/lib/systemd/user/dbus.socket
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Unit]
Description=D-Bus User Message Bus Socket

[Socket]
ListenStream=%t/bus
ExecStartPost=-/bin/systemctl --user set-environment DBUS_SESSION_BUS_ADDRESS=unix:path=%t/bus
1 change: 1 addition & 0 deletions usr/lib/systemd/user/sockets.target.wants/dbus.socket
4 changes: 4 additions & 0 deletions usr/lib/tmpfiles.d/podman.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
C /etc/containers/registries.conf - - - - /usr/etc/containers/registries.conf.example
C /etc/containers/policy.json - - - - /usr/etc/containers/policy.json.example
C /etc/subuid - - - - /usr/etc/subuid
C /etc/subgid - - - - /usr/etc/subgid

0 comments on commit 8f0c2f0

Please sign in to comment.