Skip to content

Commit

Permalink
Build OpenZFS 2.2.2 in build-tools to fix 'make test'
Browse files Browse the repository at this point in the history
Now libzfs headers are available for go-libzfs cgo build.

Signed-off-by: Andrew Durbin <andrewd@zededa.com>
  • Loading branch information
andrewd-zededa committed Mar 11, 2024
1 parent e0ea38d commit 8317674
Showing 1 changed file with 42 additions and 2 deletions.
44 changes: 42 additions & 2 deletions build-tools/src/scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,57 @@ ARG GID
# this must be an ARG so it doesn't carry through post-build phase
ARG all_proxy
# hadolint ignore=DL3018
RUN apk add --no-cache openssh-client git gcc linux-headers libc-dev util-linux libpcap-dev bash vim make protobuf protobuf-dev sudo tar curl graphviz ttf-freefont patch dnsmasq
RUN apk add --no-cache openssh-client git gcc linux-headers libc-dev util-linux libpcap-dev bash vim make protobuf \
protobuf-dev sudo tar curl graphviz ttf-freefont patch dnsmasq ca-certificates build-base gettext-dev \
libtirpc-dev automake autoconf libtool attr-dev e2fsprogs-dev glib-dev openssl-dev util-linux-dev

# we need updated libraries, here we use the same version as for eve/alpine
# hadolint ignore=DL3018
RUN apk --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/v3.16/main add -U --upgrade zfs-dev zfs-libs
#RUN apk --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/v3.16/main add -U --upgrade
RUN deluser ${USER} ; delgroup ${GROUP} || :
RUN sed -ie /:${UID}:/d /etc/passwd /etc/shadow ; sed -ie /:${GID}:/d /etc/group || :
RUN addgroup -g ${GID} ${GROUP} && adduser -h /home/${USER} -G ${GROUP} -D -H -u ${UID} ${USER}
RUN echo "${USER} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USER}
# dep is deprecated and probably should be gotten rid of; no need to parametrize the version, as there will be no further releases
# hadolint ignore=SC2086,DL4006
RUN OS="$(uname -o | tr '[:upper:]' '[:lower:]')" && PLATFORM="$(go version | sed 's#^.*'${OS}'/##g')" && curl -o /usr/local/bin/dep -L "https://github.com/golang/dep/releases/download/v0.5.4/dep-${OS}-${PLATFORM}" && chmod +x /usr/local/bin/dep
### Build OpenZFS 2.2.2 libs here for 'make test' and full eve build in one spot
# should be aligned with kernel
# * ZFS on Linux
# coreutils's uname -o breaks above url generation.

Check failure on line 29 in build-tools/src/scripts/Dockerfile

View workflow job for this annotation

GitHub Actions / yetus

blanks:end of line
RUN apk add coreutils

Check failure on line 30 in build-tools/src/scripts/Dockerfile

View workflow job for this annotation

GitHub Actions / yetus

hadolint: DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`

Check failure on line 30 in build-tools/src/scripts/Dockerfile

View workflow job for this annotation

GitHub Actions / yetus

hadolint: DL3019 info: Use the `--no-cache` switch to avoid the need to use `--update` and remove `/var/cache/apk/*` when done installing packages
ENV ZFS_VERSION=2.2.2
ENV ZFS_COMMIT=zfs-${ZFS_VERSION}
ENV ZFS_REPO=https://github.com/openzfs/zfs

WORKDIR /tmp/zfs
ADD ${ZFS_REPO}/tarball/${ZFS_COMMIT}/ zfs.tgz

Check failure on line 36 in build-tools/src/scripts/Dockerfile

View workflow job for this annotation

GitHub Actions / yetus

hadolint: DL3020 error: Use COPY instead of ADD for files and folders
RUN tar -zxvf zfs.tgz --strip-components=1 && \
rm zfs.tgz

RUN ./autogen.sh && \
./configure \
--prefix=/usr \
--with-tirpc \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--localstatedir=/var \
--with-config=user \
--with-udevdir=/lib/udev \
--disable-systemd \
--disable-static && \
./scripts/make_gitrev.sh && \
make -j "$(getconf _NPROCESSORS_ONLN)" && \
make DESTDIR=/tmp/zfs-out install-strip

# cleanup
RUN rm -rf /tmp/zfs-out/usr/share && rm -rf /tmp/zfs-out/usr/src && \
rm -rf /tmp/zfs-out/etc/init.d && rm -rf /tmp/zfs-out/etc/conf.d

RUN cp -r /tmp/zfs-out/* /


RUN go install github.com/golang/protobuf/protoc-gen-go@v1.5.2
RUN go install gotest.tools/gotestsum@v1.7.0
RUN go install github.com/seamia/protodot@87817c3d0a8e7af753af15508b51292e941bc7c6
Expand Down

0 comments on commit 8317674

Please sign in to comment.