Dockerfile

FROM gentoo/portage:latest as portage
FROM gentoo/stage3-amd64:latest

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

ENV ACCEPT_KEYWORDS="~amd64" \
    EMERGE_DEFAULT_OPTS="--jobs=4 --quiet" \
    FEATURES="-sandbox -usersandbox -ipc-sandbox -network-sandbox -mount-sandbox -pid-sandbox" \
    MAKEOPTS="-j4" \
    USE=""

RUN emerge dev-vcs/git app-portage/repoman dev-util/pkgcheck \
 && rm -rf /var/cache/distfiles/*

Building the image

From inside the my_build directory, we’ll use the docker build command, passing the -t flag to “tag” the new image with a name, which in this case will be my_image. The . indicates that the Dockerfile is in the current directory, along with so-called “context” — that is, the rest of the files that may be in that location:

cd ~/my_build
docker build -t my_image .
docker image ls

Start an interactive bash session

docker run -it --entrypoint /bin/bash my_image

if you add –rm the container gets deleted if you exit it –privileged to give extended privileges to this container

Gitlab Container Registry

docker login registry.0xacab.org -u <username> -p <token>
docker build -t registry.0xacab.org/poncho/gentoo-qa-image .
docker push registry.0xacab.org/poncho/gentoo-qa-image