Skip to content

Commit

Permalink
Merge RUN steps into single layer for disk space
Browse files Browse the repository at this point in the history
Getting errors in GitHub Actions about no more disk space

Error: committing container for step
{Env:[PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin]
Command:run Args:[rpm-ostree cleanup -m     && ostree container commit]
Flags:[] Attrs:map[] Message:RUN rpm-ostree cleanup -m     && ostree
container commit Original:RUN rpm-ostree cleanup -m     && ostree
container commit}: copying layers and metadata for container
"dd23f532b2d8f70b785c24152df66fab289c47f5948d534a3274e241fad21038":
writing blob: adding layer with blob
"sha256:e758b47523a46e040f8b12940532b5917eec98b205ad5f0d2377c55a90151faf":
processing tar file(write /usr/share/code/locales/hi.pak: no space left
on device): exit status 1
  • Loading branch information
samhclark committed Sep 14, 2024
1 parent 2837b7c commit 0678670
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,21 @@ FROM quay.io/fedora-ostree-desktops/silverblue:${silverblue_version} as silverbl
COPY docker-ce.repo /etc/yum.repos.d/docker-ce.repo
COPY vscode.repo /etc/yum.repos.d/vscode.repo

# Copying the pattern here for installing Docker Desktop
# https://github.com/coreos/rpm-ostree/issues/233#issuecomment-1301194050
# There have been updates since this was written in Nov 2022 but as of July 2024, this is still the
# recommended way https://github.com/coreos/fedora-coreos-tracker/issues/1681#issuecomment-2211137520
RUN --mount=type=bind,from=files,source=packages.json,target=/etc/packages.json \
--mount=type=bind,from=docker-desktop-rpm,source=/docker-desktop-x86_64.rpm,target=/docker-desktop-x86_64.rpm \
rpm-ostree override remove \
$(cat /etc/packages.json | jq -r '"--install=\(.add[].name)"' | xargs) \
$(cat /etc/packages.json | jq -r '.remove[].name' | xargs) \
&& systemctl enable rpm-ostreed-automatic.timer

# Copying this pattern from here https://github.com/coreos/rpm-ostree/issues/233#issuecomment-1301194050
# There have been updates since this was written in Nov 2022 but as of July 2024, this is still the
# recommended way https://github.com/coreos/fedora-coreos-tracker/issues/1681#issuecomment-2211137520
# COPY --from=docker-desktop-rpm docker-desktop-x86_64.rpm docker-desktop-x86_64.rpm
RUN --mount=type=bind,from=docker-desktop-rpm,source=/docker-desktop-x86_64.rpm,target=/docker-desktop-x86_64.rpm \
mkdir /var/opt \
&& systemctl enable rpm-ostreed-automatic.timer \
&& mkdir /var/opt \
&& rpm -Uvh docker-desktop-x86_64.rpm \
&& mv /var/opt/docker-desktop /usr/lib/opt/docker-desktop \
&& echo 'L /opt/docker-desktop - - - - ../../usr/lib/opt/docker-desktop' > /usr/lib/tmpfiles.d/docker-desktop.conf

# Make executables as read-only
RUN find /usr -type f -executable -exec chmod a-w {} +
&& echo 'L /opt/docker-desktop - - - - ../../usr/lib/opt/docker-desktop' > /usr/lib/tmpfiles.d/docker-desktop.conf \
&& find /usr -type f -executable -exec chmod a-w {} + \
&& rpm-ostree cleanup -m

RUN rpm-ostree cleanup -m \
&& ostree container commit
RUN ostree container commit

0 comments on commit 0678670

Please sign in to comment.