docker-images/gentoo-base.Dockerfile

39 lines
1.8 KiB
Docker

# Portage tree.
FROM gentoo/portage:latest as portage
# Build packages in /workdir.
FROM gentoo/stage3:amd64-nomultilib-openrc as build
COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo
RUN sed -i 's/-O2/-Os/' /etc/portage/make.conf
RUN echo -e '\n# Added by tastytea/gentoo-base:' >> /etc/portage/make.conf
# Bug 680456.
RUN echo 'FEATURES="-ipc-sandbox -mount-sandbox -network-sandbox -pid-sandbox \
-sandbox -usersandbox nodoc noinfo noman"' >> /etc/portage/make.conf
RUN echo 'MAKEOPTS="-j1"' >> /etc/portage/make.conf
RUN echo 'USE="minimal -berkdb -cracklib -gdbm -gpg -ncurses -nls \
-pam -pcre -pcre-jit -perl -readline -rsync-verify -xattr -su"' \
>> /etc/portage/make.conf
RUN echo -e 'L10N="en"\nLINGUAS="en"' >> /etc/portage/make.conf
RUN eselect profile set default/linux/amd64/17.1/no-multilib
RUN quickpkg --include-config=y @world sys-libs/glibc
RUN emerge --root=/workdir --buildpkg=y --usepkg --quiet sys-apps/portage
# Needed for locale generation.
RUN emerge --root=/workdir --buildpkg=y --usepkg --quiet --noreplace \
sys-apps/grep sys-apps/gawk app-arch/gzip sys-devel/gcc
RUN mkdir -p /workdir/etc/portage/repos.conf \
&& cp /etc/portage/make.conf /workdir/etc/portage/make.conf \
&& echo -e '[gentoo]\nlocation = /var/db/repos/gentoo' \
> /workdir/etc/portage/repos.conf/gentoo.conf
RUN rm -r /workdir/usr/lib/python*/{unit,}test
# Final image.
FROM scratch
LABEL maintainer="tastytea+docker@tastytea.de"
LABEL description="My base for Gentoo images (Without build dependencies)."
COPY --from=build /workdir /
RUN echo 'portage:x:250:250:portage:/var/tmp/portage:/bin/false' >> /etc/passwd
RUN echo 'portage::250:portage' >> /etc/group
RUN echo -e 'C.UTF-8 UTF-8\nen_DK.UTF-8 UTF-8' > /etc/locale.gen
RUN locale-gen
RUN eselect locale set en_DK.utf8