Skip to content

Commit

Permalink
Split Gentoo container build to two stages.
Browse files Browse the repository at this point in the history
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
  • Loading branch information
erezgeva committed Jan 18, 2025
1 parent b88815a commit fbf87b8
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 215 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_gentoo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:

- name: build and push
if: ${{ github.actor == github.repository_owner }}
run: gentoo/make_docker.sh -g
run: gentoo/make_docker.sh -gb
41 changes: 13 additions & 28 deletions gentoo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,20 @@
# @copyright © 2023 Erez Geva
#
# Docker file for Gentoo container for building and installing
# Search packages at: https://portagefilelist.de/
# Create from Docker image from base image
# https://dev.gentoo.org/~zmedico/portage/doc/man/emerge.1.html
# --tree, -t Shows the dependency tree
# --verbose, -v
# --update, -u
# --deep [DEPTH], -D entire dependency tree of packages
###############################################################################
FROM gentoo/stage3
MAINTAINER "Erez Geva" <ErezGeva2@gmail.com>
LABEL org.opencontainers.image.description "Gentoo build for libptpmgmt"
ARG UID
ARG USER
COPY gentoo/pkgs_use /etc/portage/package.use/pkgs
RUN emerge-webrsync && emerge -tv app-portage/portage-utils app-shells/bash\
app-admin/sudo doxygen app-editors/vim sys-apps/fakeroot dev-lua/luaposix\
sys-apps/which sys-devel/gcc libtool make dev-lang/go sys-devel/m4\
dev-util/pkgconf dev-vcs/git dev-lang/swig dev-lang/perl dev-lang/ruby\
dev-lang/python dev-lang/lua dev-lang/php dev-lang/tcl app-misc/jq\
dev-libs/criterion media-gfx/graphviz app-text/texlive-core\
dev-texlive/texlive-fontutils dev-cpp/gtest dev-util/astyle\
llvm-core/clang dev-debug/gdb app-admin/chrpath dev-util/patchelf\
app-text/discount &&\
sed -i 's/^enable_dl\s*=\s*Off/enable_dl = On/' /etc/php/*/php.ini &&\
FROM portage_base
ARG UID USER
# 559m34.815s = 9h 16m 34s
RUN emerge -tv llvm-core/clang &&\
useradd $USER -u $UID -m -G users,wheel,portage &&\
echo "$USER ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers &&\
mkdir -p /t0 && cd /t0 && git clone https://github.com/linux-rt/librtpi &&\
cd librtpi && autoreconf -i &&\
./configure --prefix=/usr --includedir=/usr/include --libdir=/usr/lib64 &&\
make install &&\
cd /t0 && git clone https://gitlab.com/chrony/libchrony &&\
cd libchrony && make install includedir=/usr/include libdir=/usr/lib64 &&\
cd && rm -Rf /t0
echo "$USER ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers
ARG COOKIE
RUN emerge --oneshot -tv sys-apps/portage
ARG SRC
ARG DST
# RUN emerge --sync && emerge -tvuD @world
ARG SRC DST
COPY --chown=builder $SRC $DST
36 changes: 36 additions & 0 deletions gentoo/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: Copyright © 2023 Erez Geva <ErezGeva2@gmail.com>
#
# @author Erez Geva <ErezGeva2@@gmail.com>
# @copyright © 2023 Erez Geva
#
# Docker file for Gentoo container base for building and installing
# Search packages at: https://portagefilelist.de/
# https://dev.gentoo.org/~zmedico/portage/doc/man/emerge.1.html
# --tree, -t Shows the dependency tree
# --verbose, -v
###############################################################################
FROM gentoo/stage3
MAINTAINER "Erez Geva" <ErezGeva2@gmail.com>
LABEL org.opencontainers.image.description "Gentoo build for libptpmgmt"
COPY gentoo/pkgs_use /etc/portage/package.use/pkgs
RUN emerge-webrsync && emerge -tvuD @world &&\
emerge -tv dev-lang/go app-portage/portage-utils app-shells/bash\
app-admin/sudo app-admin/chrpath app-editors/vim app-misc/jq\
app-text/discount app-text/doxygen sys-devel/m4\
sys-apps/fakeroot sys-apps/which dev-build/libtool\
dev-build/make dev-util/pkgconf dev-util/astyle dev-util/patchelf\
dev-vcs/git dev-libs/criterion dev-cpp/gtest dev-debug/gdb\
dev-lang/swig dev-lang/perl dev-lang/ruby dev-lang/python\
dev-lang/lua dev-lua/luaposix dev-lang/php dev-lang/tcl sys-devel/gcc\
dev-util/cppcheck media-gfx/graphviz perl-core/Test-Simple\
app-text/texlive-core dev-texlive/texlive-fontutils &&\
sed -i 's/^enable_dl\s*=\s*Off/enable_dl = On/' /etc/php/*/php.ini &&\
mkdir -p /t0 && cd /t0 && git clone https://github.com/linux-rt/librtpi &&\
cd librtpi && autoreconf -i &&\
./configure --prefix=/usr --includedir=/usr/include --libdir=/usr/lib64 &&\
make install &&\
cd /t0 && git clone https://gitlab.com/chrony/libchrony &&\
cd libchrony && make install includedir=/usr/include libdir=/usr/lib64 &&\
cd && rm -Rf /t0
ARG UID USER COOKIE SRC DST
19 changes: 0 additions & 19 deletions gentoo/Dockerfile.github

This file was deleted.

10 changes: 4 additions & 6 deletions gentoo/make_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
main()
{
local -r base_dir="$(dirname "$(realpath "$0")")"
local -r d_user=builder2
local -r d_dock_file=Dockerfile.github
local -r b_dock_file=Dockerfile.base
local -r b_name=portage_base
cd "$base_dir/.."
source tools/make_docker.sh
make_docker portage "$@"
Expand All @@ -22,10 +22,8 @@ ext()
docker run -it -w /home/builder/libptpmgmt -u builder\
-v $(realpath .):/home/builder/gentoo portage

# With '-d'
docker pull ghcr.io/erezgeva/portage
docker run -it -w /home/builder2/libptpmgmt -u builder2\
-v $(realpath .):/home/builder2/gentoo portage
docker pull ghcr.io/erezgeva/portage_base
docker tag ghcr.io/erezgeva/portage_base portage_base

# See https://wiki.gentoo.org/wiki/Gentoo_Cheat_Sheet
emerge world -ep
Expand Down
153 changes: 4 additions & 149 deletions gentoo/pkgs_use
Original file line number Diff line number Diff line change
Expand Up @@ -7,152 +7,7 @@
# Gentoo USE flags per package file
# See: https://wiki.gentoo.org/wiki/Handbook:AMD64/Working/USE
###############################################################################
app-admin/metalog unicode
app-admin/sudo nls pam secure-path sendmail ssl -gcrypt -ldap -offensive -sasl -skey -sssd -verify-sig
app-arch/libarchive acl bzip2 e2fsprogs iconv lzma xattr -blake2 -expat -lz4 -lzo -nettle -static-libs -verify-sig -zstd
app-crypt/rhash nls ssl -debug -static-libs
app-editors/vim acl crypt nls -X -cscope -debug -gpm -lua -minimal -perl -python -racket -ruby -sound -tcl -terminal -vim-pager
app-editors/vim-core acl nls -minimal
app-eselect/eselect-php -apache2 -fpm
app-portage/portage-utils openmp* qmanifest qtegrity -static
app-shells/bash net nls readline -afs -bashlogger -examples -mem-scramble -plugins -verify-sig
app-text/doxygen -clang -debug -doc -dot -doxysearch -gui -test
app-text/dvipsk -doc -source
app-text/ghostscript-gpl unicode -X -cups -dbus -gtk -static-libs
app-text/texlive-core luajittex -X -cjk -doc -source -tk -xetex -xindy
app-vim/gentoo-syntax -ignore-glep31
dev-build/cmake ncurses -dap -doc -emacs -gui -qt6 -test -verify-sig
dev-build/libtool -vanilla
dev-build/make nls -guile -static -verify-sig
dev-lang/lua deprecated readline
dev-lang/nasm -doc
dev-lang/perl gdbm -berkdb -debug -doc -ithreads -minimal -quadmath
dev-lang/php acl bzip2 cli ctype fileinfo filter flatfile gdbm iconv ipv6 jit nls opcache phar posix readline session simplexml ssl tokenizer unicode xml zlib -apache2 -apparmor -argon2 -avif -bcmath -berkdb -calendar -cdb -cgi -cjk -curl -debug -embed -enchant -exif -ffi -fpm -ftp -gd -gmp -imap -inifile -intl -iodbc -kerberos -ldap -ldap-sasl -libedit -lmdb -mhash -mssql -mysql -mysqli -oci8-instant-client -odbc -pcntl -pdo -phpdbg -postgres -qdbm -session-mm -sharedmem -snmp -soap -sockets -sodium -spell -sqlite -systemd -sysvipc -test -threads -tidy -tokyocabinet -truetype -webp -xmlreader -xmlwriter -xpm -xslt -zip
dev-lang/python ensurepip gdbm ncurses readline sqlite ssl -bluetooth -build -debug -examples -libedit -pgo -test -tk -valgrind -verify-sig
dev-lang/ruby gdbm ipv6 rdoc ssl -berkdb -debug -doc -examples -jit -socks5 -static-libs -systemtap -tk -valgrind -xemacs
dev-lang/swig pcre -ccache -doc -test
dev-lang/tcl threads -debug
dev-libs/boxfort -test
dev-libs/criterion -test
dev-libs/elfutils bzip2 nls utils -debuginfod -lzma -static-libs -test -verify-sig -zstd
dev-libs/fribidi -doc -test
dev-libs/glib elf mime xattr -dbus -debug -gtk-doc -static-libs -sysprof -systemtap -test -utils
dev-libs/gobject-introspection -doctool -gtk-doc -test
dev-libs/icu -debug -doc -examples -static-libs -test -verify-sig
dev-libs/jsoncpp -doc -test
dev-libs/kpathsea -doc -source -static-libs
dev-libs/libfmt -test
dev-libs/libgit2 ssh threads -examples -gssapi -test -trace
dev-libs/libsodium asm urandom -minimal -static-libs -verify-sig
dev-libs/libyaml -doc -static-libs -test
dev-libs/lzo -examples -static-libs
dev-libs/nanomsg -doc
dev-libs/oniguruma -crnl-as-line-terminator -static-libs
dev-libs/ptexenc iconv
dev-libs/spdlog -test
dev-libs/zziplib -sdl -static-libs
dev-perl/Authen-SASL -kerberos -test
dev-perl/B-Hooks-EndOfScope -test
dev-perl/Capture-Tiny -examples -test
dev-perl/Class-Data-Inheritable -test
dev-perl/Class-XSAccessor -test
dev-perl/Config-AutoConf -test
dev-perl/CPAN-Meta-Check -test
dev-perl/Data-OptList -test
dev-perl/Devel-Caller -test
dev-perl/Devel-GlobalDestruction -test
dev-perl/Devel-LexAlias -test
dev-perl/Devel-StackTrace -test
dev-perl/Dist-CheckConflicts -test
dev-perl/Error -test
dev-perl/Eval-Closure -minimal -test
dev-perl/Exception-Class -examples -test
dev-perl/ExtUtils-HasCompiler -test
dev-perl/File-HomeDir xdg -test
dev-perl/File-Slurper -examples -test
dev-perl/File-Which -pwhich -test
dev-perl/IO-Socket-SSL -examples -idn -test
dev-perl/Log-Dispatch -test
dev-perl/MailTools -examples -test
dev-perl/Module-Implementation -test
dev-perl/Module-Runtime -test
dev-perl/Mozilla-CA -test
dev-perl/MRO-Compat -test
dev-perl/namespace-autoclean -test
dev-perl/namespace-clean -test
dev-perl/Net-SSLeay -examples -minimal -test
dev-perl/Package-Stash -minimal -test
dev-perl/Package-Stash-XS -test
dev-perl/PadWalker -test
dev-perl/Params-Util -test
dev-perl/Params-ValidationCompiler -examples -minimal -test
dev-perl/PerlIO-utf8_strict -test
dev-perl/Perl-Tidy -examples -test
dev-perl/Ref-Util xs -test
dev-perl/Ref-Util-XS -test
dev-perl/Role-Tiny -test
dev-perl/Specio -minimal -test
dev-perl/Sub-Exporter-Progressive -test
dev-perl/Sub-Exporter -test
dev-perl/Sub-Identify -test
dev-perl/Sub-Install -test
dev-perl/Sub-Name -suggested -test
dev-perl/Sub-Quote -minimal -test
dev-perl/Test-Fatal -examples -test
dev-perl/TimeDate -test
dev-perl/Try-Tiny -minimal -test
dev-perl/Variable-Magic -examples -test
dev-perl/XString -test
dev-ruby/bundler -doc -test
dev-ruby/did_you_mean -test
dev-ruby/json -doc -test
dev-ruby/kpeg -doc -test
dev-ruby/minitest -doc -test
dev-ruby/power_assert -doc -test
dev-ruby/psych -doc -test
dev-ruby/racc -doc -test
dev-ruby/rake -doc -test
dev-ruby/rbs -doc -test
dev-ruby/rdoc -doc -test
dev-ruby/rexml -test
dev-ruby/rss -doc -test
dev-ruby/rubygems -server -test
dev-ruby/stringio -doc -test
dev-ruby/test-unit -doc -test
dev-ruby/typeprof -test
dev-tex/bibtexu -doc -source
dev-texlive/texlive-basic luajittex -doc -source
dev-texlive/texlive-fontutils -doc -source
dev-util/colm -doc
dev-util/desktop-file-utils -emacs
dev-util/pkgconf -test
dev-util/ragel -doc
dev-vcs/git blksha1 curl gpg iconv nls pcre perl safe-directory webdav -cgi -cvs -doc -highlight -keyring -mediawiki -perforce -subversion -test -tk -xinetd
mail-mta/nullmailer ssl -test
media-fonts/liberation-fonts -X -fontforge
media-fonts/urw-fonts -X
media-gfx/graphite2 -perl -test
media-gfx/graphviz cairo nls -X -devil -doc -examples -gtk2 -gts -guile -lasi -pdf -perl -postscript -python -qt5 -ruby -svg -tcl -webp
media-libs/fontconfig nls -doc -test
media-libs/freetype adobe-cff bzip2 cleartype-hinting png -X -brotli -debug -doc -fontforge -harfbuzz -static-libs -svg -utils
media-libs/gd fontconfig jpeg png truetype zlib -avif -heif -static-libs -test -tiff -webp -xpm
media-libs/harfbuzz cairo glib graphite icu introspection truetype -debug -doc -experimental -test
media-libs/jbig2dec -png -static-libs -test
media-libs/lcms -doc -jpeg -static-libs -tiff
media-libs/libjpeg-turbo -java -static-libs
media-libs/libpng -apng -static-libs
media-libs/openjpeg -doc -test
media-libs/tiff cxx zlib -jbig -jpeg -lzma -static-libs -test -verify-sig -webp -zstd
net-dns/libidn nls -emacs -verify-sig
net-libs/libssh2 zlib -gcrypt -mbedtls -test
perl-core/Test-Simple -examples
sys-apps/ed -verify-sig
sys-apps/fakeroot acl nls -debug -test
sys-devel/gcc cxx fortran multilib nls openmp pie sanitize ssp -ada -d -debug -default-stack-clash-protection -default-znow -doc -go -graphite -hardened -jit -lto -modula2 -objc -objc++ -objc-gc -pgo -systemtap -test -valgrind -vanilla -vtv -zstd
sys-devel/m4 nls -examples -verify-sig
virtual/perl-libnet ssl
x11-libs/cairo glib -X -gtk-doc -test
x11-libs/pango introspection -X -debug -sysprof -test
x11-libs/pixman -static-libs -test
x11-misc/shared-mime-info -test
x11-misc/xdg-user-dirs -gtk
dev-libs/glib -introspection -kernel_linux -selinux
media-libs/gd fontconfig truetype
media-libs/harfbuzz icu -introspection
x11-libs/pango -introspection
23 changes: 12 additions & 11 deletions tools/make_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ make_args()
}
tool_docker_get_opts()
{
local use_d use_github use_gitlab server namespace
local use_github use_gitlab server namespace
local -r uid=$(id -u)
while getopts 'nugld' opt; do
local -r user=builder
while getopts 'nuglb' opt; do
case $opt in
n)
no_cache=--no-cache
Expand All @@ -46,8 +47,8 @@ tool_docker_get_opts()
l)
use_gitlab=yes
;;
d)
use_d=yes
b)
use_b=yes
;;
esac
done
Expand All @@ -60,12 +61,9 @@ tool_docker_get_opts()
use_srv=yes
srv_ns=$server/$namespace/libptpmgmt
fi
if [[ -n "$use_d" ]] && [[ -z "$use_srv" ]] &&\
[[ -n "$d_user" ]] && [[ -n "$d_dock_file" ]]; then
local -r user=$d_user
dock_file=$d_dock_file
if [[ -n "$use_b" ]] && [[ -n "$b_dock_file" ]]; then
dock_file=$b_dock_file
else
local -r user=builder
dock_file=Dockerfile
fi
if [[ -n "$use_srv" ]]; then
Expand All @@ -87,10 +85,13 @@ tool_docker_get_opts()
}
make_docker()
{
local -r name="$1"
local name="$1"
shift
local no_cache use_srv srv_ns args dock_file
local no_cache use_srv srv_ns args dock_file use_b
tool_docker_get_opts "$@"
if [[ -n "$use_b" ]] && [[ -n "$b_name" ]]; then
name="$b_name"
fi
if [[ -z "$use_srv" ]]; then
clean_cont $name
local -r fname=$name
Expand Down
Loading

0 comments on commit fbf87b8

Please sign in to comment.