-
-
Save ajakk/44f96d529ab68806f3b87ef31e0f147e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ -z "${1}" ]]; then | |
echo "Needs an argument" | |
exit 1 | |
fi | |
DOCKERFILE="\ | |
FROM FROMIMAGE | |
ENV FEATURES \"binpkg-multi-instance\" | |
RUN ln -srf /etc/portage/world /var/lib/portage/world | |
RUN mkdir -p /etc/portage/package.unmask | |
RUN mkdir -p /etc/portage/env | |
RUN mkdir -p /etc/portage/package.env | |
RUN emerge -n1 '>=sys-apps/portage-3.0.29' | |
RUN emerge -vuDN @world --with-bdeps=y --quiet=y --buildpkg --usepkg | |
RUN perl-cleaner --all | |
RUN emerge --depclean | |
RUN emerge @preserved-rebuild | |
RUN eselect news read >/dev/null | |
CMD \"/bin/bash\"" | |
PODMAN_ARGS="--cap-add=CAP_SYS_ADMIN,CAP_NET_ADMIN,CAP_SYS_PTRACE | |
--volume /srv/portage/${1}/:/etc/portage | |
--volume /var/cache/distfiles:/var/cache/distfiles | |
--volume /var/db/repos:/var/db/repos | |
--volume /srv/binpkgs/generic:/var/cache/binpkgs" | |
target="gentoo/stage3:systemd" | |
if [[ -n $(podman images "localhost/${1}" -q) ]] 2>&1 >/dev/null; then | |
echo "Rebuilding ${1}" | |
target="localhost/${1}" | |
else | |
echo "Building ${1}" | |
fi | |
echo "${DOCKERFILE}" | sed "s FROMIMAGE ${target} " | podman build --squash-all ${PODMAN_ARGS} --tag "localhost/${1}" -f - | |
podman image prune -f | |
podman push --tls-verify=false "localhost/${1}" "localhost:5000/${1}:latest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
podman pull localhost:5000/unstable:latest -q --tls-verify=false | |
pushd ~/gentoo >/dev/null | |
git fetch --all | |
git pull | |
if [[ -n ${1} ]]; then | |
git checkout "origin/pr/${1}" | |
fi | |
popd >/dev/null | |
podman run -it \ | |
--cap-add CAP_SYS_PTRACE,CAP_SYS_ADMIN,CAP_NET_ADMIN \ | |
--volume /var/db/repos:/var/db/repos \ | |
--volume /var/cache/distfiles:/var/cache/distfiles:O \ | |
--volume /srv/portage/unstable:/etc/portage:O \ | |
--volume /srv/binpkgs/generic:/var/cache/binpkgs:O \ | |
--volume $(pwd)/gentoo:/var/db/repos/gentoo \ | |
--env TERM="${TERM}" \ | |
localhost:5000/unstable /bin/bash | |
pushd ~/gentoo >/dev/null | |
git checkout master | |
popd >/dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment