This repository has been archived on 2024-01-20. You can view files and clone it, but cannot push or open issues or pull requests.
Nils Freydank accf8c33e7
Provide the stage3 file via ARGS
My distfiles path on my host does not match the one mounted into the container.
Symlinks are not followed by podman, AFAICT due to security concerns.
Using ARGS to change the path seems reasonable to me.
2023-10-22 11:17:17 +02:00

50 lines
2.0 KiB
Docker

# SPDX-License-Identifier: MIT
# Author: Nils Freydank <nils.freydank@posteo.de>
#
# ===========================================================================
# Update the source image.
# ===========================================================================
FROM scratch as bootstrap
# Unpack the stage3 archive (which is downloaded and verifed externally).
ARG ROOTFS_FILENAME=""
ADD ${ROOTFS_FILENAME} /
# Set the profile.
RUN eselect profile set "default/linux/amd64/17.1/no-multilib/systemd/merged-usr"
# Replace /etc/portage/make.conf.
RUN rm --one-file-system /etc/portage/make.conf
COPY make.conf /etc/portage/make.conf
RUN chown root:root -R /etc/portage/make.conf
# Add overlays in /var/db/repos.
COPY repos.conf /etc/portage/repos.conf
RUN chown root:root -R /etc/portage/make.conf
# Update the compiler and glibc. Switch to the new gcc then and print the version.
RUN emerge --oneshot --usepkg sys-devel/gcc:13 sys-libs/glibc
RUN eselect gcc set x86_64-pc-linux-gnu-13 && source /etc/profile && gcc --version
# Update libtool after the compiler update.
RUN emerge --oneshot sys-devel/libtool
# Rebuild the whole world set, probably mostly with binpkgs.
RUN emerge --emptytree --verbose --usepkg @world
# Install further toolchains
RUN emerge --usepkg --noreplace dev-lang/rust dev-lang/go \
@rust-rebuild @golang-rebuild
# Rebuild packages if necessary.
RUN emerge @preserved-rebuild
# Fix stuff after perl upgrades
RUN perl-cleaner --reallyall
# ===========================================================================
# Clean up the image.
# ===========================================================================
# Unmerge stuff that is not needed.
RUN emerge --depclean
RUN rm --verbose --recursive --preserve-root /var/tmp/
# ===========================================================================
# Create the new image
# ===========================================================================
FROM scratch
COPY --from=bootstrap / /
# vim:fileencoding=utf-8:ts=4:syntax=dockerfile:expandtab