forked from wazuh/wazuh-docker
Resolved conflicts refactoring Dockerfile
This commit is contained in:
+31
-57
@@ -3,53 +3,31 @@ FROM phusion/baseimage:latest
|
|||||||
ARG FILEBEAT_VERSION=6.5.4
|
ARG FILEBEAT_VERSION=6.5.4
|
||||||
ARG WAZUH_VERSION=3.8.2-1
|
ARG WAZUH_VERSION=3.8.2-1
|
||||||
|
|
||||||
ENV API_USER="foo" \
|
# Set repositories.
|
||||||
API_PASS="bar"
|
RUN set -x && echo "deb https://packages.wazuh.com/3.x/apt/ stable main" | tee /etc/apt/sources.list.d/wazuh.list && \
|
||||||
|
curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | apt-key add - && \
|
||||||
|
curl --silent --location https://deb.nodesource.com/setup_8.x | bash - && \
|
||||||
|
echo "postfix postfix/mailname string wazuh-manager" | debconf-set-selections && \
|
||||||
|
echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections && \
|
||||||
|
groupadd -g 1000 ossec && useradd -u 1000 -g 1000 ossec
|
||||||
|
|
||||||
# Updating image
|
RUN apt-get update && apt-get upgrade -y -o Dpkg::Options::="--force-confold" && apt-get --no-install-recommends --no-install-suggests -y install openssl postfix bsd-mailx python-boto python-pip \
|
||||||
RUN apt-get update && apt-get upgrade -y -o Dpkg::Options::="--force-confold"
|
apt-transport-https vim expect nodejs python-cryptography wazuh-manager=${WAZUH_VERSION} \
|
||||||
|
wazuh-api=${WAZUH_VERSION} && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
# Set Wazuh repository.
|
# Adding first run script and entrypoint
|
||||||
RUN echo "deb https://packages.wazuh.com/3.x/apt/ stable main" | tee /etc/apt/sources.list.d/wazuh.list
|
COPY config/data_dirs.env /data_dirs.env
|
||||||
RUN curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | apt-key add -
|
COPY config/init.bash /init.bash
|
||||||
|
COPY config/entrypoint.sh /entrypoint.sh
|
||||||
# Set nodejs repository.
|
|
||||||
RUN curl --silent --location https://deb.nodesource.com/setup_8.x | bash -
|
|
||||||
|
|
||||||
# Creating ossec user as uid:gid 1000:1000
|
|
||||||
RUN groupadd -g 1000 ossec
|
|
||||||
RUN useradd -u 1000 -g 1000 -d /var/ossec ossec
|
|
||||||
|
|
||||||
# Configure postfix
|
|
||||||
RUN echo "postfix postfix/mailname string wazuh-manager" | debconf-set-selections
|
|
||||||
RUN echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
|
|
||||||
|
|
||||||
# Add universe repository
|
|
||||||
RUN add-apt-repository universe
|
|
||||||
|
|
||||||
# Install packages
|
|
||||||
RUN apt-get update && apt-get -y install openssl postfix bsd-mailx python-boto python-pip \
|
|
||||||
apt-transport-https vim expect nodejs python-cryptography wazuh-manager=${WAZUH_VERSION} \
|
|
||||||
wazuh-api=${WAZUH_VERSION} mailutils libsasl2-modules
|
|
||||||
|
|
||||||
# Adding first run script.
|
|
||||||
ADD config/data_dirs.env /data_dirs.env
|
|
||||||
ADD config/init.bash /init.bash
|
|
||||||
|
|
||||||
# Sync calls are due to https://github.com/docker/docker/issues/9547
|
# Sync calls are due to https://github.com/docker/docker/issues/9547
|
||||||
RUN chmod 755 /init.bash &&\
|
RUN chmod 755 /init.bash && \
|
||||||
sync && /init.bash &&\
|
sync && /init.bash && \
|
||||||
sync && rm /init.bash
|
sync && rm /init.bash && \
|
||||||
|
curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-${FILEBEAT_VERSION}-amd64.deb &&\
|
||||||
# Installing and configuring fiebeat
|
dpkg -i filebeat-${FILEBEAT_VERSION}-amd64.deb && rm -f filebeat-${FILEBEAT_VERSION}-amd64.deb && \
|
||||||
RUN curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-${FILEBEAT_VERSION}-amd64.deb &&\
|
chmod go-w /etc/filebeat/filebeat.yml && \
|
||||||
dpkg -i filebeat-${FILEBEAT_VERSION}-amd64.deb && rm -f filebeat-${FILEBEAT_VERSION}-amd64.deb
|
chmod 755 /entrypoint.sh
|
||||||
COPY config/filebeat.yml /etc/filebeat/
|
|
||||||
RUN chmod go-w /etc/filebeat/filebeat.yml
|
|
||||||
|
|
||||||
# Adding entrypoint
|
|
||||||
ADD config/entrypoint.sh /entrypoint.sh
|
|
||||||
RUN chmod 755 /entrypoint.sh
|
|
||||||
|
|
||||||
# Setting volumes
|
# Setting volumes
|
||||||
VOLUME ["/var/ossec/data"]
|
VOLUME ["/var/ossec/data"]
|
||||||
@@ -60,25 +38,21 @@ VOLUME ["/var/lib/filebeat"]
|
|||||||
# Services ports
|
# Services ports
|
||||||
EXPOSE 55000/tcp 1514/udp 1515/tcp 514/udp 1516/tcp
|
EXPOSE 55000/tcp 1514/udp 1515/tcp 514/udp 1516/tcp
|
||||||
|
|
||||||
# Clean up
|
|
||||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
||||||
|
|
||||||
# Adding services
|
# Adding services
|
||||||
RUN mkdir /etc/service/wazuh
|
RUN mkdir /etc/service/wazuh && \
|
||||||
|
mkdir /etc/service/wazuh-api && \
|
||||||
|
mkdir /etc/service/postfix && \
|
||||||
|
mkdir /etc/service/filebeat
|
||||||
|
|
||||||
COPY config/wazuh.runit.service /etc/service/wazuh/run
|
COPY config/wazuh.runit.service /etc/service/wazuh/run
|
||||||
RUN chmod +x /etc/service/wazuh/run
|
|
||||||
|
|
||||||
RUN mkdir /etc/service/wazuh-api
|
|
||||||
COPY config/wazuh-api.runit.service /etc/service/wazuh-api/run
|
COPY config/wazuh-api.runit.service /etc/service/wazuh-api/run
|
||||||
RUN chmod +x /etc/service/wazuh-api/run
|
|
||||||
|
|
||||||
RUN mkdir /etc/service/postfix
|
|
||||||
COPY config/postfix.runit.service /etc/service/postfix/run
|
COPY config/postfix.runit.service /etc/service/postfix/run
|
||||||
RUN chmod +x /etc/service/postfix/run
|
|
||||||
|
|
||||||
RUN mkdir /etc/service/filebeat
|
|
||||||
COPY config/filebeat.runit.service /etc/service/filebeat/run
|
COPY config/filebeat.runit.service /etc/service/filebeat/run
|
||||||
RUN chmod +x /etc/service/filebeat/run
|
|
||||||
|
RUN chmod +x /etc/service/wazuh-api/run && \
|
||||||
|
chmod +x /etc/service/wazuh/run && \
|
||||||
|
chmod +x /etc/service/postfix/run && \
|
||||||
|
chmod +x /etc/service/filebeat/run
|
||||||
|
|
||||||
# Run all services
|
# Run all services
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|||||||
Reference in New Issue
Block a user