Skip to content

Commit fb1e67d

Browse files
arun hundaragiarun hundaragi
arun hundaragi
authored and
arun hundaragi
committed
Reverted back the push.yaml and build-image.sh script changes, made changes in dockerfile and initscript
1 parent 29973d8 commit fb1e67d

File tree

3 files changed

+43
-17
lines changed

3 files changed

+43
-17
lines changed

build-docker-images/wazuh-manager/Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ FROM ubuntu:focal
33

44
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
55

6-
ARG WAZUH_VERSION
7-
ARG WAZUH_TAG_REVISION
6+
ARG WAZUH_VERSION=4.7.2
7+
ARG WAZUH_TAG_REVISION=1
88
ARG FILEBEAT_TEMPLATE_BRANCH
99
ARG FILEBEAT_CHANNEL=filebeat-oss
1010
ARG FILEBEAT_VERSION=7.10.2
@@ -13,11 +13,13 @@ ARG WAZUH_FILEBEAT_MODULE
1313
RUN apt-get update && apt install curl apt-transport-https lsb-release gnupg -y
1414

1515
COPY config/check_repository.sh /
16-
RUN chmod 775 /check_repository.sh
17-
RUN source /check_repository.sh
16+
RUN chmod 775 /check_repository.sh && \
17+
. /check_repository.sh && \
18+
echo "WAZUH_VERSION: $WAZUH_VERSION" && \
19+
echo "WAZUH_TAG_REVISION: $WAZUH_TAG_REVISION"
1820

1921
RUN apt-get update && \
20-
apt-get install wazuh-manager=${WAZUH_VERSION}-${WAZUH_TAG_REVISION}
22+
apt-get install -y wazuh-manager=${WAZUH_VERSION}-${WAZUH_TAG_REVISION}
2123

2224
COPY config/filebeat_module.sh /
2325
RUN chmod 775 /filebeat_module.sh

build-docker-images/wazuh-manager/config/check_repository.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ elif [ "$MAJOR_BUILD" -eq "$MAJOR_CURRENT" ]; then
2525
fi
2626
fi
2727

28-
apt-key adv --fetch-keys ${APT_KEY}
28+
curl -fsSL ${APT_KEY} | gpg --dearmor | tee /etc/apt/trusted.gpg.d/wazuh.gpg > /dev/null
2929
echo ${REPOSITORY} | tee -a /etc/apt/sources.list.d/wazuh.list
Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1+
#!/bin/bash
2+
3+
# Define the default repository
14
REPOSITORY="packages.wazuh.com/4.x"
5+
6+
# Fetch the latest Wazuh version from GitHub
27
WAZUH_CURRENT_VERSION=$(curl --silent https://api.github.com/repos/wazuh/wazuh/releases/latest | grep '\"tag_name\":' | sed -E 's/.*\"([^\"]+)\".*/\1/' | cut -c 2-)
3-
MAJOR_BUILD=$(echo $WAZUH_VERSION | cut -d. -f1)
4-
MID_BUILD=$(echo $WAZUH_VERSION | cut -d. -f2)
5-
MINOR_BUILD=$(echo $WAZUH_VERSION | cut -d. -f3)
6-
MAJOR_CURRENT=$(echo $WAZUH_CURRENT_VERSION | cut -d. -f1)
7-
MID_CURRENT=$(echo $WAZUH_CURRENT_VERSION | cut -d. -f2)
8-
MINOR_CURRENT=$(echo $WAZUH_CURRENT_VERSION | cut -d. -f3)
9-
10-
## check version to use the correct repository
8+
9+
# Extract version components
10+
MAJOR_BUILD=$(echo "$WAZUH_VERSION" | cut -d. -f1)
11+
MID_BUILD=$(echo "$WAZUH_VERSION" | cut -d. -f2)
12+
MINOR_BUILD=$(echo "$WAZUH_VERSION" | cut -d. -f3)
13+
MAJOR_CURRENT=$(echo "$WAZUH_CURRENT_VERSION" | cut -d. -f1)
14+
MID_CURRENT=$(echo "$WAZUH_CURRENT_VERSION" | cut -d. -f2)
15+
MINOR_CURRENT=$(echo "$WAZUH_CURRENT_VERSION" | cut -d. -f3)
16+
17+
# Select repository based on version comparison
1118
if [ "$MAJOR_BUILD" -gt "$MAJOR_CURRENT" ]; then
1219
REPOSITORY="packages-dev.wazuh.com/pre-release"
1320
elif [ "$MAJOR_BUILD" -eq "$MAJOR_CURRENT" ]; then
@@ -20,8 +27,25 @@ elif [ "$MAJOR_BUILD" -eq "$MAJOR_CURRENT" ]; then
2027
fi
2128
fi
2229

23-
curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/${FILEBEAT_CHANNEL}-${FILEBEAT_VERSION}-amd64.deb &&\
24-
dpkg -i ${FILEBEAT_CHANNEL}-${FILEBEAT_VERSION}-amd64.deb && rm -f ${FILEBEAT_CHANNEL}-${FILEBEAT_VERSION}-amd64.deb && \
30+
# Detect system architecture (amd64 or arm64)
31+
ARCH=$(dpkg --print-architecture)
32+
if [ "$ARCH" == "arm64" ]; then
33+
FILEBEAT_ARCH="arm64"
34+
else
35+
FILEBEAT_ARCH="amd64"
36+
fi
37+
38+
# Download and install the correct Filebeat package
39+
curl -L -O "https://artifacts.elastic.co/downloads/beats/filebeat/${FILEBEAT_CHANNEL}-${FILEBEAT_VERSION}-${FILEBEAT_ARCH}.deb"
40+
dpkg -i "${FILEBEAT_CHANNEL}-${FILEBEAT_VERSION}-${FILEBEAT_ARCH}.deb"
41+
rm -f "${FILEBEAT_CHANNEL}-${FILEBEAT_VERSION}-${FILEBEAT_ARCH}.deb"
42+
43+
# Ensure the Filebeat module directory exists before extraction
44+
mkdir -p /usr/share/filebeat/module
45+
46+
# Extract Filebeat modules
2547
curl -s https://duplo-wazuh.s3.us-west-2.amazonaws.com/duplo-wazuh-filebeat.tar.gz | tar -xvz -C /usr/share/filebeat/module
48+
49+
# Set correct ownership and permissions
2650
chown -R root:root /usr/share/filebeat/module
27-
chmod -R go-w /usr/share/filebeat/module/
51+
chmod -R go-w /usr/share/filebeat/module

0 commit comments

Comments
 (0)