Skip to content

Commit

Permalink
NO-ISSUE: Add dump.erofs to the image
Browse files Browse the repository at this point in the history
This patch adds the `dump.erofs` binary to the image. To do so it
fetches the source and builds it inside a separate _tools_ container.

Signed-off-by: Juan Hernandez <[email protected]>
  • Loading branch information
jhernand committed Feb 18, 2025
1 parent f123ff8 commit b370a7f
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
44 changes: 44 additions & 0 deletions Dockerfile.image-service
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
# Used to build tools:
FROM quay.io/centos/centos:stream9 AS tools

# Install packages:
RUN \
dnf install -y \
gcc \
git \
libselinux-devel \
libtool \
libuuid-devel \
libzstd-devel \
lz4-devel \
make \
xz-devel \
zlib-devel \
&& \
dnf clean all

# Build erofs-utils:
RUN \
mkdir /tmp/build && \
cd /tmp/build && \
curl --output tarball https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/snapshot/erofs-utils-1.8.5.tar.gz && \
tar --extract --strip-components 1 --file tarball && \
./autogen.sh && \
./configure \
--with-libzstd \
--with-lz4 \
--with-lzma \
--with-selinux \
--with-uuid \
--with-zlib \
&& \
make && \
make install && \
rm -rf /tmp/build


# Used to build the service:
FROM registry.access.redhat.com/ubi9/go-toolset:1.21 AS golang

USER 0
Expand Down Expand Up @@ -53,7 +93,11 @@ COPY --from=golang /commit-reference.txt /commit-reference.txt

USER $UID:$GID

COPY --from=tools /usr/local/bin/* /usr/local/bin
COPY --from=golang /tmp/licenses /licenses
COPY --from=golang /assisted-image-service /assisted-image-service

# TODO: This is just to show that the binary is working, should be removed.
RUN dump.erofs --help

CMD ["/assisted-image-service"]
44 changes: 44 additions & 0 deletions Dockerfile.image-service-mce
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
# Used to build tools:
FROM --platform=$BUILDPLATFORM registry.redhat.io/rhel9-4-els/rhel:9.4 AS tools

# Install packages:
RUN \
dnf install -y \
gcc \
git \
libselinux-devel \
libtool \
libuuid-devel \
libzstd-devel \
lz4-devel \
make \
xz-devel \
zlib-devel \
&& \
dnf clean all

# Build erofs-utils:
RUN \
mkdir /tmp/build && \
cd /tmp/build && \
curl --output tarball https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/snapshot/erofs-utils-1.8.5.tar.gz && \
tar --extract --strip-components 1 --file tarball && \
./autogen.sh && \
./configure \
--with-libzstd \
--with-lz4 \
--with-lzma \
--with-selinux \
--with-uuid \
--with-zlib \
&& \
make && \
make install && \
rm -rf /tmp/build


# Used to build the service:
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/go-toolset:1.21 AS builder
ARG TARGETOS
ARG TARGETARCH
Expand Down Expand Up @@ -32,9 +72,13 @@ ENV DATA_DIR=$DATA_DIR

RUN dnf -y update && dnf install -y cpio squashfs-tools && dnf clean all

COPY --from=tools /usr/local/bin/* /usr/local/bin
COPY LICENSE /licenses/
COPY --from=builder /app/assisted-image-service /assisted-image-service

# TODO: This is just to show that the binary is working, should be removed.
RUN dump.erofs --help

CMD ["/assisted-image-service"]

USER ${USER_UID}
Expand Down

0 comments on commit b370a7f

Please sign in to comment.