Refactor execution stage into multiple layers
This commit is contained in:
+31
-9
@@ -34,19 +34,41 @@ FROM quay.io/fedora/fedora-kinoite:44
|
||||
# RUN rm /opt && mkdir /opt
|
||||
|
||||
###############################################################################
|
||||
# EXECUTION STAGE
|
||||
# EXECUTION STAGE (Aufgeteilt in Cache-Layer)
|
||||
###############################################################################
|
||||
# Hier werden die Skripte aus dem Kontext-Stage ausgeführt
|
||||
RUN --mount=type=bind,from=ctx,source=/,target=/ctx \
|
||||
--mount=type=bind,from=ctx,source=/configs,target=/configs \
|
||||
--mount=type=bind,from=ctx,source=/scripts,target=/scripts \
|
||||
|
||||
# LAYER 1: Repositories einrichten (Ändert sich fast nie)
|
||||
RUN --mount=type=bind,from=ctx,source=/build/10-repos.sh,target=/tmp/10-repos.sh \
|
||||
--mount=type=cache,dst=/var/cache \
|
||||
--mount=type=cache,dst=/var/log \
|
||||
--mount=type=tmpfs,dst=/tmp \
|
||||
for s in /ctx/build/*.sh; do \
|
||||
echo "Running $s" && \
|
||||
bash "$s" || exit 1; \
|
||||
done
|
||||
bash /tmp/10-repos.sh && dnf5 clean all
|
||||
|
||||
# LAYER 2: Multimedia Stack (Großer Download - stark gecacht)
|
||||
RUN --mount=type=bind,from=ctx,source=/build/20-multimedia.sh,target=/tmp/20-multimedia.sh \
|
||||
--mount=type=cache,dst=/var/cache \
|
||||
--mount=type=cache,dst=/var/log \
|
||||
--mount=type=tmpfs,dst=/tmp \
|
||||
bash /tmp/20-multimedia.sh
|
||||
|
||||
# LAYER 3: Virtualisierung & Tools (Großer Download - stark gecacht)
|
||||
RUN --mount=type=bind,from=ctx,source=/build/30-virt.sh,target=/tmp/30-virt.sh \
|
||||
--mount=type=cache,dst=/var/cache \
|
||||
--mount=type=cache,dst=/var/log \
|
||||
--mount=type=tmpfs,dst=/tmp \
|
||||
bash /tmp/30-virt.sh
|
||||
|
||||
# LAYER 4: Unerwünschte Pakete entfernen (Bereinigungsschicht)
|
||||
RUN --mount=type=bind,from=ctx,source=/build/40-remove-packages.sh,target=/tmp/40-remove-packages.sh \
|
||||
--mount=type=cache,dst=/var/cache \
|
||||
--mount=type=cache,dst=/var/log \
|
||||
--mount=type=tmpfs,dst=/tmp \
|
||||
bash /tmp/40-remove-packages.sh
|
||||
|
||||
# LAYER 5: Flatpak Vorbereitung (Winzig, ganz unten)
|
||||
RUN --mount=type=bind,from=ctx,source=/build/50-prepare-flatpak-for-bazaar.sh,target=/tmp/50-prepare-flatpak-for-bazaar.sh \
|
||||
--mount=type=tmpfs,dst=/tmp \
|
||||
bash /tmp/50-prepare-flatpak-for-bazaar.sh
|
||||
|
||||
###############################################################################
|
||||
# CONFIGURATION LAYER (Der "saubere" Teil)
|
||||
|
||||
Reference in New Issue
Block a user