Brak opisu

Dockerfile 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. # Wazuh Docker Copyright (C) 2017, Wazuh Inc. (License GPLv2)
  2. FROM amazonlinux:2023 AS builder
  3. ARG WAZUH_VERSION
  4. ARG WAZUH_TAG_REVISION
  5. ARG WAZUH_UI_REVISION
  6. ARG INSTALL_DIR=/usr/share/wazuh-dashboard
  7. # Update and install dependencies
  8. RUN yum install curl-minimal libcap openssl -y
  9. COPY config/check_repository.sh /
  10. RUN chmod 775 /check_repository.sh && \
  11. source /check_repository.sh
  12. RUN yum install wazuh-dashboard-${WAZUH_VERSION}-${WAZUH_TAG_REVISION} -y && \
  13. yum clean all
  14. # Create and set permissions to data directories
  15. RUN mkdir -p $INSTALL_DIR/data/wazuh && chmod -R 775 $INSTALL_DIR/data/wazuh
  16. RUN mkdir -p $INSTALL_DIR/data/wazuh/config && chmod -R 775 $INSTALL_DIR/data/wazuh/config
  17. RUN mkdir -p $INSTALL_DIR/data/wazuh/logs && chmod -R 775 $INSTALL_DIR/data/wazuh/logs
  18. COPY config/wazuh.yml $INSTALL_DIR/data/wazuh/config/
  19. RUN setcap 'cap_net_bind_service=-ep' /usr/share/wazuh-dashboard/node/bin/node
  20. RUN setcap 'cap_net_bind_service=-ep' /usr/share/wazuh-dashboard/node/fallback/bin/node
  21. # Generate certificates
  22. COPY config/config.sh .
  23. COPY config/config.yml /
  24. RUN bash config.sh
  25. ################################################################################
  26. # Build stage 1 (the current Wazuh dashboard image):
  27. #
  28. # Copy wazuh-dashboard from stage 0
  29. # Add entrypoint
  30. # Add wazuh_app_config
  31. ################################################################################
  32. FROM amazonlinux:2023
  33. # Set environment variables
  34. ENV USER="wazuh-dashboard" \
  35. GROUP="wazuh-dashboard" \
  36. NAME="wazuh-dashboard" \
  37. INSTALL_DIR="/usr/share/wazuh-dashboard"
  38. # Set Wazuh app variables
  39. ENV PATTERN="" \
  40. CHECKS_PATTERN="" \
  41. CHECKS_TEMPLATE="" \
  42. CHECKS_API="" \
  43. CHECKS_SETUP="" \
  44. APP_TIMEOUT="" \
  45. API_SELECTOR="" \
  46. IP_SELECTOR="" \
  47. IP_IGNORE="" \
  48. WAZUH_MONITORING_ENABLED="" \
  49. WAZUH_MONITORING_FREQUENCY="" \
  50. WAZUH_MONITORING_SHARDS="" \
  51. WAZUH_MONITORING_REPLICAS=""
  52. # Update and install dependencies
  53. RUN yum install shadow-utils -y
  54. # Create wazuh-dashboard user and group
  55. RUN getent group $GROUP || groupadd -r -g 1000 $GROUP
  56. RUN useradd --system \
  57. --uid 1000 \
  58. --no-create-home \
  59. --home-dir $INSTALL_DIR \
  60. --gid $GROUP \
  61. --shell /sbin/nologin \
  62. --comment "$USER user" \
  63. $USER
  64. # Copy and set permissions to scripts
  65. COPY config/entrypoint.sh /
  66. COPY config/wazuh_app_config.sh /
  67. RUN chmod 700 /entrypoint.sh
  68. RUN chmod 700 /wazuh_app_config.sh
  69. RUN chown 1000:1000 /*.sh
  70. # Copy Install dir from builder to current image
  71. COPY --from=builder --chown=1000:1000 $INSTALL_DIR $INSTALL_DIR
  72. # Create custom directory
  73. RUN mkdir -p /usr/share/wazuh-dashboard/plugins/wazuh/public/assets/custom
  74. RUN chown 1000:1000 /usr/share/wazuh-dashboard/plugins/wazuh/public/assets/custom
  75. # Set workdir and user
  76. WORKDIR $INSTALL_DIR
  77. USER wazuh-dashboard
  78. # Services ports
  79. EXPOSE 443
  80. ENTRYPOINT [ "/entrypoint.sh" ]