Skip to content

Commit

Permalink
Add Gentoo images
Browse files Browse the repository at this point in the history
This PR creates two images based on upstream ones with tags `latest` and
`systemd`.
  • Loading branch information
Robin Lee committed Aug 4, 2023
1 parent 191fbbc commit d1d3ce3
Show file tree
Hide file tree
Showing 19 changed files with 369 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/gentoo-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "Gentoo: Build toolbx images for PRs"

permissions: read-all

on:
pull_request:
branches:
- main
paths:
- gentoo/**
- .github/workflows/gentoo-pr.yaml

env:
distro: 'gentoo'
distro_pretty: 'Gentoo'

jobs:
build-images:
strategy:
matrix:
upstream_tag: ['latest', 'systemd']

runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build ${{ env.distro_pretty }} ${{ matrix.upstream_tag }} toolbox image
uses: docker/build-push-action@v3
with:
context: ${{ env.distro }}/${{ matrix.upstream_tag }}
file: ${{ env.distro }}/${{ matrix.upstream_tag }}/Containerfile
platforms: linux/amd64,linux/arm64
push: false
no-cache: true
tags: quay.io/toolbx-images/${{ env.distro }}-toolbox:${{ matrix.upstream_tag }}
54 changes: 54 additions & 0 deletions .github/workflows/gentoo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "Gentoo: Build and push toolbx images"

permissions: read-all

on:
push:
branches:
- main
paths:
- gentoo/**
- .github/workflows/gentoo.yaml
schedule:
- cron: '0 0 * * MON'

# Prevent multiple workflow runs from racing
concurrency: ${{ github.workflow }}

env:
distro: 'gentoo'
distro_pretty: 'Gentoo'

jobs:
build-and-push-images:
strategy:
matrix:
upstream_tag: ['latest', 'systemd']

runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: 'toolbx-images+github'
password: ${{ secrets.QUAY_ROBOT_TOKEN }}

- name: Build and push ${{ env.distro_pretty }} ${{ matrix.upstream_tag }} toolbox image
uses: docker/build-push-action@v3
with:
context: ${{ env.distro }}/${{ matrix.upstream_tag }}
file: ${{ env.distro }}/${{ matrix.upstream_tag }}/Containerfile
platforms: linux/amd64,linux/arm64
push: true
no-cache: true
tags: quay.io/toolbx-images/${{ env.distro }}-toolbox:${{ matrix.upstream_tag }}
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ directly use the commands below:
$ toolbox enter debian-toolbox-10
```

- [Gentoo]:
```
$ toolbox create --image quay.io/toolbx-images/gentoo-toolbox:latest
$ toolbox enter gentoo-toolbox-latest
$ toolbox create --image quay.io/toolbx-images/gentoo-toolbox:systemd
$ toolbox enter gentoo-toolbox-systemd
```

- [openSUSE]:
```
$ toolbox create --image quay.io/toolbx-images/opensuse-toolbox:tumbleweed
Expand Down Expand Up @@ -151,6 +160,7 @@ directly use the commands below:
[CentOS (Stream)]: https://www.centos.org/centos-stream/
[EPEL]: https://docs.fedoraproject.org/en-US/epel/
[Debian]: https://hub.docker.com/_/debian
[Gentoo]: https://hub.docker.com/u/gentoo
[Red Hat Enterprise Linux (Universal Base Image)]: https://developers.redhat.com/products/rhel/ubi
[Red Hat Universal Base Image End User Licensing Agreement]: https://www.redhat.com/licenses/EULA_Red_Hat_Universal_Base_Image_English_20190422.pdf
[Rocky Linux]: https://hub.docker.com/_/rockylinux
Expand Down
32 changes: 32 additions & 0 deletions gentoo/latest/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM docker.io/gentoo/portage:latest as portage

FROM docker.io/gentoo/stage3:latest

LABEL com.github.containers.toolbox="true" \
name="gentoo-toolbox" \
version="latest" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Gentoo toolbox containers" \
maintainer="Robin Lee <[email protected]>"

COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo

# build all UTF-8 locales
RUN echo > /etc/env.d/02locale && grep UTF-8 /usr/share/i18n/SUPPORTED > /etc/locale.gen && locale-gen

# flatpak-spawn is not available in offical Gentoo repo
RUN mkdir /etc/portage/repos.conf && \
echo 'x11-misc/flatpak-xdg-utils' > /etc/portage/package.accept_keywords/toolbox
COPY localrepo.conf /etc/portage/repos.conf
COPY localrepo /var/db/repos/localrepo
COPY extra-packages /

RUN emerge -v $(<extra-packages)

# Enable sudo permission for wheel users
RUN mkdir /etc/sudoers.d && chmod 700 /etc/sudoers.d && echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/toolbox

# Clean up
RUN rm -frv /var/db/repos/gentoo \
/etc/portage/repos.conf/localrepo.conf /var/db/repos/localrepo \
extra-packages
38 changes: 38 additions & 0 deletions gentoo/latest/extra-packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
app-shells/bash-completion
sys-devel/bc
app-arch/bzip2
sys-apps/diffutils
sys-apps/findutils
x11-misc/flatpak-xdg-utils
dev-vcs/git
app-crypt/gnupg
sys-apps/net-tools
sys-apps/iproute2
net-misc/iputils
sys-apps/keyutils
app-crypt/mit-krb5
sys-apps/less
sys-process/lsof
sys-apps/man-db
sys-apps/man-pages
net-analyzer/mtr
app-editors/nano
sys-auth/nss-mdns
net-misc/openssh
sys-apps/shadow
app-arch/pigz
sys-process/procps
net-misc/rsync
app-admin/sudo
net-analyzer/tcpdump
sys-process/time
net-analyzer/traceroute
app-text/tree
app-arch/unzip
sys-apps/util-linux
net-misc/wget
sys-apps/which
sys-apps/miscfiles
x11-apps/xauth
app-arch/xz-utils
app-arch/zip
2 changes: 2 additions & 0 deletions gentoo/latest/localrepo.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[localrepo]
location = /var/db/repos/localrepo
18 changes: 18 additions & 0 deletions gentoo/latest/localrepo/metadata/layout.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
masters = gentoo

# manifest-hashes specify hashes used for new/updated entries
# the current set went live on 2017-11-21, per 2017-11-12 Council meeting
# https://archives.gentoo.org/gentoo-dev/message/ba2e5d9666ebd7e1bff1143485a37856
manifest-hashes = BLAKE2B SHA512

# The following hashes are required on all Manifest entries. If any
# of them are missing, repoman will refetch and rehash old distfiles.
# Otherwise, old distfiles will keep using their current hash set.
manifest-required-hashes = BLAKE2B

# Do not update changelogs
update-changelog = false
# Use thin manifests
thin-manifests = true
# Dont sign thinn manifests. There is no current policy for git commit signing
sign-manifests = false
1 change: 1 addition & 0 deletions gentoo/latest/localrepo/profiles/repo_name
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
localrepo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DIST flatpak-xdg-utils-1.0.5.tar.xz 36744 BLAKE2B 5fb4a1bf65e94e767cacc627e53caba72fa3a077e6f058ceb366f50f704716248baba378de84addf5c7bb45c748b151fc8b9a7f00ef87cc778be1c7bfc17cdf9 SHA512 71c55cc01dc962c1b419821160626c46111ad672241f7627dbf780790d4f9f320151f479264ffc188334488f43dee8f4f7aa7754040e9c6231c200ea281f6439
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit meson

DESCRIPTION="Utilities for containerized apps to launch programs outside the container"
HOMEPAGE="https://github.com/flatpak/flatpak-xdg-utils"
SRC_URI="https://github.com/flatpak/flatpak-xdg-utils/releases/download/${PV}/flatpak-xdg-utils-${PV}.tar.xz"

LICENSE="LGPL-2.1"
SLOT="0"
RDEPEND="dev-libs/glib:2"
DEPEND="${RDEPEND}"
BDEPEND="${RDEPEND}"
KEYWORDS="~amd64"

src_configure() {
meson_src_configure --bindir=/usr/lib/"${PN}"
}

src_install() {
meson_src_install
dosym -r /usr/lib/"${PN}"/flatpak-spawn /usr/bin/flatpak-spawn
}
13 changes: 13 additions & 0 deletions gentoo/latest/localrepo/x11-misc/flatpak-xdg-utils/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE
pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<name>ston</name>
<email>[email protected]</email>
</maintainer>
<upstream>
<remote-id type="github">
flatpak/flatpak-xdg-utils</remote-id>
</upstream>
</pkgmetadata>
33 changes: 33 additions & 0 deletions gentoo/systemd/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM docker.io/gentoo/portage:latest as portage

FROM docker.io/gentoo/stage3:systemd

LABEL com.github.containers.toolbox="true" \
name="gentoo-toolbox" \
version="systemd" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Gentoo toolbox containers" \
maintainer="Robin Lee <[email protected]>"

COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo

# build all UTF-8 locales
#RUN echo > /etc/locale.conf && grep UTF-8 /usr/share/i18n/SUPPORTED > /etc/locale.gen && locale-gen
RUN echo > /etc/env.d/02locale && grep UTF-8 /usr/share/i18n/SUPPORTED > /etc/locale.gen && locale-gen

# flatpak-spawn is not available in offical Gentoo repo
RUN mkdir /etc/portage/repos.conf && \
echo 'x11-misc/flatpak-xdg-utils' > /etc/portage/package.accept_keywords/toolbox
COPY localrepo.conf /etc/portage/repos.conf
COPY localrepo /var/db/repos/localrepo
COPY extra-packages /

RUN emerge -v $(<extra-packages)

# Enable sudo permission for wheel users
RUN mkdir /etc/sudoers.d && chmod 700 /etc/sudoers.d && echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/toolbox

# Clean up
RUN rm -frv /var/db/repos/gentoo \
/etc/portage/repos.conf/localrepo.conf /var/db/repos/localrepo \
extra-packages
38 changes: 38 additions & 0 deletions gentoo/systemd/extra-packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
app-shells/bash-completion
sys-devel/bc
app-arch/bzip2
sys-apps/diffutils
sys-apps/findutils
x11-misc/flatpak-xdg-utils
dev-vcs/git
app-crypt/gnupg
sys-apps/net-tools
sys-apps/iproute2
net-misc/iputils
sys-apps/keyutils
app-crypt/mit-krb5
sys-apps/less
sys-process/lsof
sys-apps/man-db
sys-apps/man-pages
net-analyzer/mtr
app-editors/nano
sys-auth/nss-mdns
net-misc/openssh
sys-apps/shadow
app-arch/pigz
sys-process/procps
net-misc/rsync
app-admin/sudo
net-analyzer/tcpdump
sys-process/time
net-analyzer/traceroute
app-text/tree
app-arch/unzip
sys-apps/util-linux
net-misc/wget
sys-apps/which
sys-apps/miscfiles
x11-apps/xauth
app-arch/xz-utils
app-arch/zip
2 changes: 2 additions & 0 deletions gentoo/systemd/localrepo.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[localrepo]
location = /var/db/repos/localrepo
18 changes: 18 additions & 0 deletions gentoo/systemd/localrepo/metadata/layout.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
masters = gentoo

# manifest-hashes specify hashes used for new/updated entries
# the current set went live on 2017-11-21, per 2017-11-12 Council meeting
# https://archives.gentoo.org/gentoo-dev/message/ba2e5d9666ebd7e1bff1143485a37856
manifest-hashes = BLAKE2B SHA512

# The following hashes are required on all Manifest entries. If any
# of them are missing, repoman will refetch and rehash old distfiles.
# Otherwise, old distfiles will keep using their current hash set.
manifest-required-hashes = BLAKE2B

# Do not update changelogs
update-changelog = false
# Use thin manifests
thin-manifests = true
# Dont sign thinn manifests. There is no current policy for git commit signing
sign-manifests = false
1 change: 1 addition & 0 deletions gentoo/systemd/localrepo/profiles/repo_name
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
localrepo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DIST flatpak-xdg-utils-1.0.5.tar.xz 36744 BLAKE2B 5fb4a1bf65e94e767cacc627e53caba72fa3a077e6f058ceb366f50f704716248baba378de84addf5c7bb45c748b151fc8b9a7f00ef87cc778be1c7bfc17cdf9 SHA512 71c55cc01dc962c1b419821160626c46111ad672241f7627dbf780790d4f9f320151f479264ffc188334488f43dee8f4f7aa7754040e9c6231c200ea281f6439
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit meson

DESCRIPTION="Utilities for containerized apps to launch programs outside the container"
HOMEPAGE="https://github.com/flatpak/flatpak-xdg-utils"
SRC_URI="https://github.com/flatpak/flatpak-xdg-utils/releases/download/${PV}/flatpak-xdg-utils-${PV}.tar.xz"

LICENSE="LGPL-2.1"
SLOT="0"
RDEPEND="dev-libs/glib:2"
DEPEND="${RDEPEND}"
BDEPEND="${RDEPEND}"
KEYWORDS="~amd64"

src_configure() {
meson_src_configure --bindir=/usr/lib/"${PN}"
}

src_install() {
meson_src_install
dosym -r /usr/lib/"${PN}"/flatpak-spawn /usr/bin/flatpak-spawn
}
Loading

0 comments on commit d1d3ce3

Please sign in to comment.