Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(images): use multi-stage to reduce populate_jail image size #151

Merged
merged 3 commits into from
Oct 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions images/populate_jail/populate_jail.dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
ARG BASE_IMAGE=ubuntu:jammy

# First stage: untap jail_rootfs.tar
FROM $BASE_IMAGE AS untaped
COPY jail_rootfs.tar /jail_rootfs.tar
RUN mkdir /jail && tar -xvf /jail_rootfs.tar -C /jail && rm /jail_rootfs.tar

# Second stage: copy untaped jail environment to the target
FROM $BASE_IMAGE AS populate_jail

ARG DEBIAN_FRONTEND=noninteractive

RUN apt update && apt install -y rclone rsync

COPY jail_rootfs.tar /jail_rootfs.tar

RUN mkdir /jail && tar -xvf /jail_rootfs.tar -C /jail && rm /jail_rootfs.tar
COPY --from=untaped /jail /jail

COPY populate_jail/populate_jail_entrypoint.sh .
RUN chmod +x ./populate_jail_entrypoint.sh
Expand Down