blob: e7002035af9a5730a0b2faf24e3ff9345d4cf4ac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# This Dockerfile creates a gentoo stage4 container image. By default it
# creates a stage4-amd64 image. It utilizes a multi-stage build and requires
# docker-17.05.0 or later.
ARG BOOTSTRAPTAG=gentoo/stage3:latest
FROM gentoo/portage:latest as portage
FROM ${BOOTSTRAPTAG}
ARG KEYWORDS
ARG PROJECTUUID
ARG BINHOSTURL
ARG ARCH
ARG BOOTSTRAPTAG=gentoo/stage3:latest
ARG DOCKERFILE
ARG NODE
# copy the entire portage volume in
COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo
# Setup portage for git install
RUN echo 'FEATURES="-ipc-sandbox -pid-sandbox -network-sandbox -usersandbox -mount-sandbox sandbox"' | cat >> /etc/portage/make.conf\
&& echo 'MAKEOPTS="-j8"' | cat >> /etc/portage/make.conf
# Install git
RUN emerge -qv dev-vcs/git
# Setup portage for the rest of the build
RUN echo -e "[binhost]\npriority = 9999\nsync-uri = ${BINHOSTURL}/${PROJECTUUID}/packages/\n" | cat >> /etc/portage/binrepos.conf\
&& echo 'EMERGE_DEFAULT_OPTS="--rebuild-if-new-rev=y --rebuilt-binaries=y --usepkg=y --nospinner --color=n --ask=n"' | cat >> /etc/portage/make.conf\
&& echo 'FEATURES="${FEATURES} parallel-fetch -merge-sync "' | cat >> /etc/portage/make.conf\
&& echo 'FEATURES="${FEATURES} getbinpkg"' | cat >> /etc/portage/make.conf\
&& echo 'COMMON_FLAGS="${COMMON_FLAGS} -fno-diagnostics-color -march=native"' | >> /etc/portage/make.conf\
&& echo 'USE="X elogind"' | >> /etc/portage/make.conf\
# && echo 'PYTHON_TARGETS="python3_10 python3_9 python3_8 python3_11"' | >> /etc/portage/make.conf\
&& echo 'ACCEPT_LICENSE="*"'\
&& echo 'PORTAGE_COMPRESS="xz"'\
&& echo 'BINPKG_COMPRESS="xz"'\
#&& echo 'dev-vcs/git -webdev -gnome-keyring' | cat >> /etc/portage/package.use/git\
#&& echo 'dev-util/buildbot-worker' | cat >> /etc/portage/package.accept_keywords/buildbot\
#&& echo 'dev-libs/glib' | cat >> /etc/portage/package.mask/git\
&& ( sed -i -e 's/#rc_sys=""/rc_sys="docker"/g' /etc/rc.conf 2>/dev/null || true ) \
&& echo 'UTC' > /etc/timezone
# Setup LANG
RUN echo 'en_US.UTF-8 UTF-8' | cat >> /etc/locale.gen\
&& echo 'en_US ISO-8859-1' | cat >> /etc/locale.gen\
&& echo 'C.UTF8 UTF-8' | cat >> /etc/locale.gen\
&& echo 'LANG="en_US.utf8"' | cat >> /etc/locale.conf\
&& locale-gen
# clone gentoo repo use github https for
# gitlab.gentoo.org do timeout on https
RUN rm -R /var/db/repos/gentoo\
&& git clone --depth=1 https://github.com/gentoo/gentoo.git /var/db/repos/gentoo
# set accept_keywords
RUN echo 'ACCEPT_KEYWORDS="'"${KEYWORDS}"'"' | cat >> /etc/portage/make.conf
# Setup world file
RUN echo 'app-text/ansifilter' | cat >> /var/lib/portage/world\
&& echo 'dev-util/pkgcheck' | cat >> /var/lib/portage/world\
&& echo 'dev-lang/rust-bin' | cat >> /var/lib/portage/world\
&& echo 'app-admin/eclean-kernel' | cat >> /var/lib/portage/world\
&& echo 'app-portage/gentoolkit' | cat >> /var/lib/portage/world\
&& echo 'app-editors/nano' | cat >> /var/lib/portage/world\
&& echo 'app-arch/xz-utils' | cat >> /var/lib/portage/world
# Run emerge update and install buildbot-worker
# update perl
RUN emerge -1qv perl\
&& perl-cleaner --all
# update openssl
RUN emerge -1qv openssl python
# update system
RUN emerge -uDNqv --deep @world
# install kernel and buildbot-worker
RUN emerge -qv gentoo-kernel-bin\
&& emerge -qv buildbot-worker
# Rm the gentoo repo
RUN rm -R /var/db/repos/gentoo
# Setup the buildbot-worker
WORKDIR /var/lib/buildbot_worker
RUN wget https://raw.githubusercontent.com/buildbot/buildbot/master/worker/docker/buildbot.tac\
&& ( sed -i -e 's/umask = None/umask = 0o22/g' buildbot.tac 2>/dev/null || true ) \
&& mkdir info\
&& echo "${PROJECTUUID} ${ARCH} ${BOOTSTRAPTAG} ${DOCKERFILE} ${NODE}" | cat > info/host
ENTRYPOINT ["/usr/bin/buildbot-worker"]
CMD ["start", "--nodaemon"]
#CMD ["/bin/bash"]
|