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

Enable arm64 packages building using remote binary caching #506

Merged
merged 4 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
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
20 changes: 5 additions & 15 deletions packages/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,17 @@ set_vcpkg_remote_binary_cache(){

if [[ $(mono --version 2>/dev/null) =~ [0-9] ]]; then
echo "mono already installed, proceeding"

git clone --branch master --single-branch https://github.com/microsoft/vcpkg.git
pushd vcpkg

export VCPKG_ROOT="$(pwd)"

git checkout "2024.09.30"

export VCPKG_BINARY_SOURCES="clear;nuget,GitHub,readwrite"
./bootstrap-vcpkg.sh
mono `./vcpkg fetch nuget | tail -n 1` \
NUGET_PATH="/usr/local/bin/nuget"
curl -o $NUGET_PATH https://dist.nuget.org/win-x86-commandline/v6.10.2/nuget.exe
mono $NUGET_PATH \
sources add \
-source "https://nuget.pkg.github.com/wazuh/index.json" \
-name "GitHub" \
-username "wazuh" \
-password "$vcpkg_token"
mono `./vcpkg fetch nuget | tail -n 1` \
mono $NUGET_PATH \
setapikey "$vcpkg_token" \
-source "https://nuget.pkg.github.com/wazuh/index.json"

popd
-source "https://nuget.pkg.github.com/wazuh/index.json"
else
echo "mono in not installed, remote binary caching not being enabled"
fi
Expand Down
2 changes: 1 addition & 1 deletion packages/debs/SPECS/wazuh-agent/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Source: wazuh-agent
Section: admin
Priority: extra
Maintainer: Wazuh, Inc <[email protected]>
Build-Depends: debhelper (>= 7.0.50~), make, gcc, linux-libc-dev, gawk, libaudit-dev, selinux-basics
Build-Depends: debhelper (>= 7.0.50~), make, gcc, linux-libc-dev, gawk, selinux-basics
Standards-Version: 3.8.4
Homepage: https://www.wazuh.com

Expand Down
30 changes: 4 additions & 26 deletions packages/debs/amd64/agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@ FROM debian:10

ENV DEBIAN_FRONTEND=noninteractive

# Installing necessary packages
RUN apt-get update && apt-get install -y build-essential \
curl wget git gawk devscripts sudo libssl-dev \
unzip zip tar texinfo pkg-config clang-tidy uuid \
libmpfr-dev libgmp3-dev libmpc-dev autopoint libtool \
zlib1g-dev libgcrypt20-dev libmagic-dev libpopt-dev \
libmagic-dev libsqlite3-dev gettext \
ninja-build libsystemd-dev libaudit-dev selinux-basics \
libarchive-dev debhelper libssl-dev libbz2-dev \
&& rm -rf /var/lib/apt/lists/*
curl wget git devscripts sudo libssl-dev unzip zip \
tar pkg-config autopoint libtool gettext ninja-build \
libsystemd-dev selinux-basics debhelper \
&& rm -rf /var/lib/apt/lists/*

RUN echo "deb http://ftp.de.debian.org/debian bullseye main" >>/etc/apt/sources.list && \
apt-get update && apt-get install -y g++-10 && rm -rf /var/lib/apt/lists/*
Expand All @@ -35,23 +30,6 @@ RUN curl -OL https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.
make -j$(nproc) && make install && ln -fs /usr/local/bin/cmake /usr/bin/cmake && \
cd / && rm -rf cmake-*

RUN curl -sO https://lua.org/ftp/lua-5.4.7.tar.gz && tar -xzvf lua-5.4.7.tar.gz && \
cd lua-5.4.7 && make -j$(nproc) linux CFLAGS+="-fPIC" LDFLAGS+="-fPIC" && make install && \
ln -fs /usr/local/bin/lua /usr/bin/lua && cd / && rm -rf lua*

RUN mkdir -p /usr/local/lib/pkgconfig && \
echo "# Package Information for pkg-config" > /usr/local/lib/pkgconfig/lua.pc && \
echo "prefix=/usr/local" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "exec_prefix=\${prefix}" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "libdir=\${exec_prefix}/lib" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "includedir=\${prefix}/include" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "Name: Lua" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "Description: Lua" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "Version: 5.4.7" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "Libs: -L\${libdir} -llua -lm" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "Cflags: -I\${includedir}" >> /usr/local/lib/pkgconfig/lua.pc

RUN git config --global --add safe.directory /wazuh-local-src

RUN apt update && apt install dirmngr gnupg apt-transport-https ca-certificates -y && \
Expand Down
37 changes: 7 additions & 30 deletions packages/debs/arm64/agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@ FROM arm64v8/debian:10

ENV DEBIAN_FRONTEND=noninteractive

# Installing necessary packages
RUN apt-get update && apt-get install -y build-essential \
curl wget git gawk devscripts sudo libssl-dev \
unzip zip tar texinfo pkg-config clang-tidy uuid \
libmpfr-dev libgmp3-dev libmpc-dev autopoint libtool \
zlib1g-dev libgcrypt20-dev libmagic-dev libpopt-dev \
libmagic-dev libsqlite3-dev gettext ninja-build \
ninja-build libsystemd-dev libaudit-dev selinux-basics \
libarchive-dev debhelper libssl-dev libbz2-dev \
&& rm -rf /var/lib/apt/lists/*
curl wget git devscripts sudo libssl-dev unzip zip \
tar pkg-config autopoint libtool gettext ninja-build \
libsystemd-dev selinux-basics debhelper nuget \
&& rm -rf /var/lib/apt/lists/*

RUN echo "deb http://ftp.de.debian.org/debian bullseye main" >>/etc/apt/sources.list && \
apt-get update && apt-get install -y g++-10 && rm -rf /var/lib/apt/lists/*
Expand All @@ -35,26 +30,8 @@ RUN curl -OL https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.
make -j$(nproc) && make install && ln -s /usr/local/bin/cmake /usr/bin/cmake && \
cd / && rm -rf cmake-*

RUN curl -sO https://lua.org/ftp/lua-5.4.7.tar.gz && tar -xzvf lua-5.4.7.tar.gz && \
cd lua-5.4.7 && make -j$(nproc) linux CFLAGS+="-fPIC" LDFLAGS+="-fPIC" && make install && \
ln -fs /usr/local/bin/lua /usr/bin/lua && cd / && rm -rf lua*

RUN mkdir -p /usr/local/lib/pkgconfig && \
echo "# Package Information for pkg-config" > /usr/local/lib/pkgconfig/lua.pc && \
echo "prefix=/usr/local" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "exec_prefix=\${prefix}" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "libdir=\${exec_prefix}/lib" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "includedir=\${prefix}/include" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "Name: Lua" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "Description: Lua" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "Version: 5.4.7" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "Libs: -L\${libdir} -llua -lm" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "Cflags: -I\${includedir}" >> /usr/local/lib/pkgconfig/lua.pc

RUN git config --global --add safe.directory /wazuh-local-src

RUN apt update && apt install dirmngr gnupg apt-transport-https ca-certificates -y && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \
sh -c 'echo "deb https://download.mono-project.com/repo/debian stable-buster main" > /etc/apt/sources.list.d/mono-official-stable.list' && \
apt update && apt install mono-complete -y
RUN git clone https://github.com/mono/mono.git && cd mono && \
./autogen.sh --prefix=/usr/local && make -j $(nproc) && make install -j $(nproc) && \
cd .. && rm -rf mono && update-ca-certificates && cert-sync /etc/ssl/certs/ca-certificates.crt
39 changes: 0 additions & 39 deletions packages/debs/armhf/agent/Dockerfile

This file was deleted.

38 changes: 0 additions & 38 deletions packages/debs/i386/agent/Dockerfile

This file was deleted.

38 changes: 0 additions & 38 deletions packages/debs/ppc64le/agent/Dockerfile

This file was deleted.

3 changes: 3 additions & 0 deletions packages/generate_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ SYSTEM="deb"
OUTDIR="${CURRENT_PATH}/output/"
BRANCH=""
VCPKG_KEY=""
VCPKG_BINARY_SOURCES=""
REVISION="0"
TARGET="agent"
JOBS="2"
Expand Down Expand Up @@ -77,6 +78,7 @@ build_pkg() {
-e WAZUH_BRANCH="${BRANCH}" \
-e WAZUH_VERBOSE="${VERBOSE}" \
-e VCPKG_KEY="${VCPKG_KEY}" \
-e VCPKG_BINARY_SOURCES="${VCPKG_BINARY_SOURCES}" \
${CUSTOM_CODE_VOL} \
-v ${DOCKERFILE_PATH}:/home:Z \
${CONTAINER_NAME}:${DOCKER_TAG} \
Expand Down Expand Up @@ -237,6 +239,7 @@ main() {
"--vcpkg-binary-caching-key")
if [ -n "$2" ]; then
VCPKG_KEY="$2"
VCPKG_BINARY_SOURCES="clear;nuget,GitHub,readwrite"
shift 2
else
help 1
Expand Down
39 changes: 9 additions & 30 deletions packages/rpms/amd64/agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@ COPY CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo
RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
RUN yum clean all && yum update -y

RUN yum install -y gcc make wget git \
openssh-clients sudo gnupg libdb libdb-devel\
automake autoconf libtool policycoreutils-python \
yum-utils epel-release redhat-rpm-config rpm-devel \
autopoint gettext nspr nspr-devel \
nss nss-devel magic magic-devel \
db4 db4-devel zlib zlib-devel rpm-build bison \
sharutils bzip2-devel xz-devel lzo-devel \
e2fsprogs-devel libacl-devel libattr-devel \
openssl-devel libxml2-devel kexec-tools elfutils \
libarchive-devel elfutils-libelf-devel \
patchelf elfutils-devel libgcrypt-devel \
file-devel gettext-devel curl-devel systemd-devel
RUN yum install -y gcc make wget git openssh-clients sudo gnupg \
libdb-devel libtool policycoreutils-python epel-release \
redhat-rpm-config rpm-devel autopoint nspr-devel nss-devel \
db4-devel rpm-build bison sharutils lzo-devel e2fsprogs-devel \
libacl-devel libattr-devel openssl-devel kexec-tools \
libarchive-devel elfutils-libelf-devel patchelf elfutils-devel \
libgcrypt-devel file-devel gettext-devel curl-devel systemd-devel

RUN yum-builddep python34 -y

Expand Down Expand Up @@ -51,21 +45,12 @@ RUN git clone https://github.com/Perl/perl5.git --branch v5.34.0 --single-branch
make -j$(nproc) && make install && ln -fs /usr/local/bin/perl /bin/perl && \
cd / && rm -rf perl*

RUN curl -O http://packages.wazuh.com/utils/autoconf/autoconf-2.69.tar.gz && \
gunzip autoconf-2.69.tar.gz && tar xvf autoconf-2.69.tar && \
cd autoconf-2.69 && ./configure && make -j$(nproc) && \
make install && cd / && rm -rf autoconf-*

RUN git clone https://github.com/sqlite/sqlite.git --branch version-3.46.1 --single-branch && \
cd sqlite && ./configure && make -j$(nproc) && \
make install -j$(nproc) && ln -fs /usr/local/bin/sqlite3 /usr/bin/sqlite3 && \
cd / && rm -rf sqlit*

RUN curl -sO https://lua.org/ftp/lua-5.4.7.tar.gz && tar -xzvf lua-5.4.7.tar.gz && \
cd lua-5.4.7 && make -j$(nproc) linux CFLAGS+="-fPIC" LDFLAGS+="-fPIC" && make install && \
ln -fs /usr/local/bin/lua /usr/bin/lua && cd / && rm -rf lua*

RUN echo "# Package Information for pkg-config" > /usr/local/lib/pkgconfig/lua.pc && \
RUN mkdir -p /usr/local/lib/pkgconfig && \
echo "# Package Information for pkg-config" > /usr/local/lib/pkgconfig/lua.pc && \
echo "prefix=/usr/local" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "exec_prefix=\${prefix}" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "libdir=\${exec_prefix}/lib" >> /usr/local/lib/pkgconfig/lua.pc && \
Expand All @@ -77,10 +62,6 @@ RUN echo "# Package Information for pkg-config" > /usr/local/lib/pkgconfig/lua.p
echo "Libs: -L\${libdir} -llua -lm" >> /usr/local/lib/pkgconfig/lua.pc && \
echo "Cflags: -I\${includedir}" >> /usr/local/lib/pkgconfig/lua.pc

RUN git clone https://github.com/rpm-software-management/popt.git --branch popt-1.19-release --single-branch && \
cd popt && ./autogen.sh && ./configure && make -j$(nproc) && make install -j$(nproc) && \
cd / && rm -rf popt*

RUN git clone https://github.com/rpm-software-management/rpm.git --branch rpm-4.15.1-release --single-branch && \
cd rpm && ./autogen.sh && make -j$(nproc) && make install && cd / && rm -rf rpm*

Expand All @@ -91,5 +72,3 @@ RUN mkdir -p /usr/local/var/lib/rpm && \
RUN rpmkeys --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" && \
su -c 'curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo' && \
yum install mono-devel -y

RUN curl -o /usr/local/bin/nuget https://dist.nuget.org/win-x86-commandline/v6.10.2/nuget.exe
Loading