diff --git a/.github/workflows/images_build.yml b/.github/workflows/images_build.yml index 558971615..38b9a649e 100644 --- a/.github/workflows/images_build.yml +++ b/.github/workflows/images_build.yml @@ -1,4 +1,4 @@ -name: Images build +name: Build images (DockerHub) on: release: @@ -10,166 +10,207 @@ on: - '5.0' - '5.4' - 'trunk' - paths-ignore: - - 'env_vars/*' - - 'docker-compose*.yaml' - - 'Dockerfiles/*/rhel/*' - - "**.md" + paths: + - 'Dockerfiles/**' + - '!Dockerfiles/*/rhel/*' + - '!Dockerfiles/*/windows/*' + - '.github/workflows/images_build.yml' defaults: run: shell: bash +env: + DOCKER_REPOSITORY: "zabbix" + LATEST_BRANCH: ${{ github.event.repository.default_branch }} + BASE_BUILD_NAME: "build-base" + jobs: - build: - timeout-minutes: 70 - env: - LATEST_BRANCH: "${{ github.event.repository.default_branch }}" - DOCKER_REPOSITORY: "zabbix" - strategy: - fail-fast: false - matrix: - build: - - agent - - agent2 - - java-gateway - - proxy-mysql - - proxy-sqlite3 - - server-mysql - - server-pgsql - - snmptraps - - web-apache-mysql - - web-apache-pgsql - - web-nginx-mysql - - web-nginx-pgsql - os: - - alpine - - ubuntu - - ol - - runs-on: ubuntu-20.04 + init_build: + name: Initialize build + runs-on: ubuntu-latest + outputs: + os: ${{ steps.os.outputs.list }} + database: ${{ steps.database.outputs.list }} + components: ${{ steps.components.outputs.list }} + is_default_branch: ${{ steps.branch_info.outputs.is_default }} steps: - - - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 1 - - - name: Set up QEMU + - name: Check build.json file + id: build_exists + run: | + if [[ ! -f "./build.json" ]]; then + echo "::error::File build.json is missing" + exit 1 + fi + + - name: Prepare Operating System list + id: os + run: | + os_list=$(jq -r '.["os-linux"] | keys | [ .[] | tostring ] | @json' "./build.json") + + echo "::set-output name=list::$os_list" + + - name: Prepare Platform list + id: platform_list + run: | + platform_list=$(jq -r '.["os-linux"] | tostring | @json' "./build.json") + + echo "::set-output name=list::$platform_list" + + - name: Prepare Database engine list + id: database + run: | + database_list=$(jq -r '[.components | values[] ] | sort | unique | del(.. | select ( . == "" ) ) | [ .[] | tostring ] | @json' "./build.json") + + echo "::set-output name=list::$database_list" + + - name: Prepare Zabbix component list + id: components + run: | + component_list=$(jq -r '.components | keys | [ .[] | tostring ] | @json' "./build.json") + + echo "::set-output name=list::$component_list" + + - name: Get branch info + id: branch_info + uses: tj-actions/branch-names@v5 + + build_base: + timeout-minutes: 70 + name: Build base on ${{ matrix.os }} + needs: init_build + strategy: + fail-fast: false + matrix: + os: ${{ fromJson(needs.init_build.outputs.os) }} + + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 1 + + - name: Set up QEMU uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx + + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub + + - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Prepare platform list + - name: Prepare Platform list id: platform run: | - DOCKER_PLATFORM="linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/s390x" + platform_list=$(jq -r '.["os-linux"].${{ matrix.os }} | join(",")' "./build.json") - if [ "${{ matrix.build }}" == "agent2" ]; then - DOCKER_PLATFORM="linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le" - fi + echo ::set-output name=list::$platform_list - if [ "${{ matrix.os }}" == "ubuntu" ]; then - DOCKER_PLATFORM="linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le" - fi + - name: Generate tags + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.DOCKER_REPOSITORY }}/zabbix-${{ env.BASE_BUILD_NAME }} + tags: | + type=ref,event=branch,prefix=${{ matrix.os }}- + type=ref,event=branch,suffix=-${{ matrix.os }} + flavor: | + latest=false - if [ "${{ matrix.build }}" == "java-gateway" ]; then - DOCKER_PLATFORM=${DOCKER_PLATFORM%",linux/ppc64le"} - fi + - name: Build ${{ env.BASE_BUILD_NAME }}/${{ matrix.os }} and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: ./Dockerfiles/${{ env.BASE_BUILD_NAME }}/${{ matrix.os }} + file: ./Dockerfiles/${{ env.BASE_BUILD_NAME }}/${{ matrix.os }}/Dockerfile + platforms: ${{ steps.platform.outputs.list }} + push: ${{ secrets.AUTO_PUSH_IMAGES }} + tags: ${{ steps.meta.outputs.tags }} + labels: | + org.opencontainers.image.revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} + org.opencontainers.image.created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} - if [ "${{ matrix.build }}" == "web-service" ]; then - DOCKER_PLATFORM=${DOCKER_PLATFORM%",linux/ppc64le"} - fi - - if [ "${{ matrix.os }}" == "ol" ]; then - DOCKER_PLATFORM="linux/amd64,linux/arm64" - fi - - echo ::set-output name=list::${DOCKER_PLATFORM} - - - name: Prepare environment (push) - if: github.event_name == 'push' - id: prepare_push + - name: Image digest run: | - TAGS_ARRAY=() + echo ${{ steps.docker_build.outputs.digest }} + echo "${{ steps.docker_build.outputs.digest }}" > ${{ env.BASE_BUILD_NAME }}_${{ matrix.os }} - IMAGE_NAME="${{ env.DOCKER_REPOSITORY }}/zabbix-${{ matrix.build }}" - GIT_BRANCH="${{ github.ref }}" - GIT_BRANCH=${GIT_BRANCH:11} + - name: Upload SHA256 tag + uses: actions/upload-artifact@v2.2.4 + with: + name: ${{ env.BASE_BUILD_NAME }}_${{ matrix.os }} + path: ${{ env.BASE_BUILD_NAME }}_${{ matrix.os }} + if-no-files-found: error - echo "::debug::Branch - ${GIT_BRANCH}" + build_base_database: + timeout-minutes: 70 + needs: [ "build_base", "init_build"] + name: Build ${{ matrix.build }} base on ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + build: ${{ fromJson(needs.init_build.outputs.database) }} + os: ${{ fromJson(needs.init_build.outputs.os) }} - if [ "${GIT_BRANCH}" == "trunk" ]; then - TAGS_ARRAY+=("$IMAGE_NAME:${{ matrix.os }}-${GIT_BRANCH}") - TAGS_ARRAY+=("$IMAGE_NAME:${GIT_BRANCH}-${{ matrix.os }}") - else - TAGS_ARRAY+=("$IMAGE_NAME:${{ matrix.os }}-${GIT_BRANCH}-latest") - TAGS_ARRAY+=("$IMAGE_NAME:${GIT_BRANCH}-${{ matrix.os }}-latest") - fi + runs-on: ubuntu-20.04 + steps: + - name: Checkout repository + uses: actions/checkout@v2.3.4 - if [ "${{ matrix.os }}" == "alpine" ] && [ "${LATEST_BRANCH}" == "${GIT_BRANCH}" ]; then - TAGS_ARRAY+=("$IMAGE_NAME:latest") - fi + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 - if [ "${LATEST_BRANCH}" == "${GIT_BRANCH}" ]; then - TAGS_ARRAY+=("$IMAGE_NAME:${{ matrix.os }}-latest") - fi + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 - TAGS=$(printf -- "%s, " "${TAGS_ARRAY[@]}") + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - echo "::debug::Tags - ${TAGS}" - - echo ::set-output name=image_name::${IMAGE_NAME} - echo ::set-output name=image_tag_versions::$(printf -- "%s," "${TAGS_ARRAY[@]}") - - - name: Prepare environment (release) - if: github.event_name == 'release' && github.event.action == 'published' - id: prepare_release + - name: Prepare Platform list + id: platform run: | - TAGS_ARRAY=() + platform_list=$(jq -r '.["os-linux"].${{ matrix.os }} | join(",")' "./build.json") - IMAGE_NAME="${{ env.DOCKER_REPOSITORY }}/zabbix-${{ matrix.build }}" - RELEASE_VERSION="${{ github.ref }}" - RELEASE_VERSION=${RELEASE_VERSION:10} - GIT_BRANCH=${RELEASE_VERSION%.*} + echo ::set-output name=list::$platform_list - echo "::debug::Release version ${RELEASE_VERSION}. Branch ${GIT_BRANCH}" + - name: Generate tags + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.DOCKER_REPOSITORY }}/zabbix-${{ matrix.build }} + tags: | + type=ref,event=branch,prefix=${{ matrix.os }}- + type=ref,event=branch,suffix=-${{ matrix.os }} + flavor: | + latest=false - TAGS_ARRAY+=("$IMAGE_NAME:${{ matrix.os }}-${RELEASE_VERSION}") - TAGS_ARRAY+=("$IMAGE_NAME:${RELEASE_VERSION}-${{ matrix.os }}") + - name: Download SHA256 tag build-base:${{ matrix.os }} + uses: actions/download-artifact@v2.0.10 + with: + name: build-base_${{ matrix.os }} - if [ "${{ matrix.os }}" == "alpine" ] && [ "${LATEST_BRANCH}" == "${GIT_BRANCH}" ]; then - TAGS_ARRAY+=("$IMAGE_NAME:latest") - fi - - TAGS=$(printf -- "--tag %s " "${TAGS_ARRAY[@]}") - - echo ::set-output name=image_name::${IMAGE_NAME} - echo ::set-output name=image_tag_versions::$(printf -- ",%s" "${TAGS_ARRAY[@]}") - - - name: Prepare tags - id: prepare_tags + - name: Retrieve build-base:${{ matrix.os }} SHA256 tag + id: base_build run: | - if [ ! -z "${{ steps.prepare_push.outputs.image_tag_versions }}" ]; then - TAGS="${{ steps.prepare_push.outputs.image_tag_versions }}" - IMAGE_NAME="${{ steps.prepare_push.outputs.image_name }}" - elif [ ! -z "${{ steps.prepare_release.outputs.image_tag_versions }}" ]; then - TAGS="${{ steps.prepare_release.outputs.image_tag_versions }}" - IMAGE_NAME="${{ steps.prepare_release.outputs.image_name }}" - else - exit 1 - fi + BASE_TAG=$(cat build-base_${{ matrix.os }}) + BUILD_BASE_IMAGE=${{ env.DOCKER_REPOSITORY }}/zabbix-build-base@${BASE_TAG} - echo ::set-output name=image_tag_versions::${TAGS} - echo ::set-output name=image_name::${IMAGE_NAME} + echo ::set-output name=base_tag::${BASE_TAG} + echo ::set-output name=base_build_image::${BUILD_BASE_IMAGE} - - - name: Build and push + - name: Build ${{ matrix.build }}/${{ matrix.os }} and push id: docker_build uses: docker/build-push-action@v2 with: @@ -177,8 +218,109 @@ jobs: file: ./Dockerfiles/${{ matrix.build }}/${{ matrix.os }}/Dockerfile platforms: ${{ steps.platform.outputs.list }} push: ${{ secrets.AUTO_PUSH_IMAGES }} - tags: ${{ steps.prepare_tags.outputs.image_tag_versions }} + tags: ${{ steps.meta.outputs.tags }} + build-args: BUILD_BASE_IMAGE=${{ steps.base_build.outputs.base_build_image }} + labels: | + org.opencontainers.image.revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} + org.opencontainers.image.created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} - - - name: Image digest + - name: Image digest + run: | + echo ${{ steps.docker_build.outputs.digest }} + echo "${{ steps.docker_build.outputs.digest }}" > ${{ matrix.build }}_${{ matrix.os }} + + - name: Upload SHA256 tag + uses: actions/upload-artifact@v2.2.4 + with: + name: ${{ matrix.build }}_${{ matrix.os }} + path: ${{ matrix.build }}_${{ matrix.os }} + if-no-files-found: error + + build_images: + timeout-minutes: 70 + needs: [ "build_base_database", "init_build"] + name: Build ${{ matrix.build }} on ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + build: ${{ fromJson(needs.init_build.outputs.components) }} + os: ${{ fromJson(needs.init_build.outputs.os) }} + + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2.3.4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Prepare Platform list + id: platform + run: | + # Chromium on Alpine is available only on linux/amd64, linux/arm64 platforms + if [ "${{ matrix.os }}" == "alpine" ] && [ "${{ matrix.build }}" == "web-service" ]; then + platform_list="linux/amd64,linux/arm64" + else + platform_list=$(jq -r '.["os-linux"].${{ matrix.os }} | join(",")' "./build.json") + fi + + echo ::set-output name=list::$platform_list + + - name: Detect Build Base Image + id: build_base_image + run: | + BUILD_BASE=$(jq -r '.components."${{ matrix.build }}"' "./build.json") + + echo ::set-output name=build_base::${BUILD_BASE} + + - name: Generate tags + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.DOCKER_REPOSITORY }}/zabbix-${{ matrix.build }} + tags: | + type=ref,event=branch,prefix=${{ matrix.os }}- + type=ref,event=branch,suffix=-${{ matrix.os }} + flavor: | + latest=false + + - name: Download SHA256 tag for ${{ steps.build_base_image.outputs.build_base }}:${{ matrix.os }} + uses: actions/download-artifact@v2.0.10 + if: ${{ matrix.build != 'snmptraps' }} + with: + name: ${{ steps.build_base_image.outputs.build_base }}_${{ matrix.os }} + + - name: Retrieve ${{ steps.build_base_image.outputs.build_base }}:${{ matrix.os }} SHA256 tag + id: base_build + if: ${{ matrix.build != 'snmptraps' }} + run: | + BASE_TAG=$(cat ${{ steps.build_base_image.outputs.build_base }}_${{ matrix.os }}) + BUILD_BASE_IMAGE=${{ env.DOCKER_REPOSITORY }}/zabbix-${{ steps.build_base_image.outputs.build_base }}@${BASE_TAG} + + echo ::set-output name=base_tag::${BASE_TAG} + echo ::set-output name=base_build_image::${BUILD_BASE_IMAGE} + + - name: Build ${{ matrix.build }}/${{ matrix.os }} and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: ./Dockerfiles/${{ matrix.build }}/${{ matrix.os }} + file: ./Dockerfiles/${{ matrix.build }}/${{ matrix.os }}/Dockerfile + platforms: ${{ steps.platform.outputs.list }} + push: ${{ secrets.AUTO_PUSH_IMAGES }} + tags: ${{ steps.meta.outputs.tags }} + build-args: BUILD_BASE_IMAGE=${{ steps.base_build.outputs.base_build_image }} + labels: | + org.opencontainers.image.revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} + org.opencontainers.image.created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} + + - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/images_build_windows.yml b/.github/workflows/images_build_windows.yml new file mode 100644 index 000000000..86c69d131 --- /dev/null +++ b/.github/workflows/images_build_windows.yml @@ -0,0 +1,381 @@ +name: Build images (DockerHub, Windows) + +on: + release: + types: + - published + push: + branches: + - '4.0' + - '5.0' + - '5.4' + - 'trunk' + paths: + - 'Dockerfiles/*/windows/*' + - '.github/workflows/images_build_windows.yml' + +defaults: + run: + shell: pwsh + +env: + DOCKER_REPOSITORY: "zabbix" + LATEST_BRANCH: ${{ github.event.repository.default_branch }} + IMAGE_PREFIX: "zabbix-" + BASE_BUILD_NAME: "build-base" + COMPONENT_BASE_BUILD_NAME: "build-mysql" + AUTO_PUSH_IMAGES: ${{ secrets.AUTO_PUSH_IMAGES }} + +jobs: + init_build: + name: Initialize build + runs-on: ubuntu-latest + outputs: + os: ${{ steps.os.outputs.list }} + components: ${{ steps.components.outputs.list }} + is_default_branch: ${{ steps.branch_info.outputs.is_default }} + steps: + - name: Checkout repository + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 1 + + - name: Check build.json file + id: build_exists + shell: bash + run: | + if [[ ! -f "./build.json" ]]; then + echo "::error::File build.json is missing" + exit 1 + fi + + - name: Prepare Operating System list + id: os + shell: bash + run: | + os_list=$(jq -r '.["os-windows"] | keys | [ .[] | tostring ] | @json' "./build.json") + + echo "::set-output name=list::$os_list" + + - name: Prepare Zabbix component list + id: components + shell: bash + run: | + component_list='["agent","agent2"]' + + echo "::set-output name=list::$component_list" + + - name: Get branch info + id: branch_info + uses: tj-actions/branch-names@v5 + + build_base: + timeout-minutes: 70 + name: Build ${{ matrix.component }} base on ${{ matrix.os }} + needs: init_build + env: + BASE_BUILD_ARTIFACT_FILE_SUFFIX: "_${{ matrix.os }}_${{ matrix.component }}" + strategy: + fail-fast: false + matrix: + os: ${{ fromJson(needs.init_build.outputs.os) }} + component: ${{ fromJson(needs.init_build.outputs.components) }} + + runs-on: ${{ matrix.os }} + steps: + - name: Checkout repository + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 1 + + - name: Login to DockerHub + run: | + docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + if (-not $?) {throw "Failed"} + + - name: Base OS tag + id: base_os_tag + run: | + $os_tag=$(Get-Content -Path .\build.json | ConvertFrom-Json).'os-windows'.'${{ matrix.os }}' + echo "::set-output name=os_tag::$os_tag" + + - name: Generate tags + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.DOCKER_REPOSITORY }}/${{ env.IMAGE_PREFIX }}${{ env.BASE_BUILD_NAME }} + tags: | + type=semver,pattern={{version}},prefix=${{ matrix.component }}-${{ steps.base_os_tag.outputs.os_tag }}- + type=semver,pattern={{version}},suffix=-${{ steps.base_os_tag.outputs.os_tag }},prefix=${{ matrix.component }}- + type=ref,event=branch,prefix=${{ matrix.component }}-${{ steps.base_os_tag.outputs.os_tag }}-,suffix=-latest + type=ref,event=branch,suffix=-${{ steps.base_os_tag.outputs.os_tag }}-latest,prefix=${{ matrix.component }}- + type=raw,enable=${{ needs.init_build.outputs.is_default_branch == 'true' }},value=${{ matrix.component }}-${{ steps.base_os_tag.outputs.os_tag }}-latest + flavor: | + latest=false + + - name: Build image + id: docker_build + run: | + $context='.\Dockerfiles\${{ env.BASE_BUILD_NAME }}\windows\' + $dockerfile= $context + 'Dockerfile.${{ matrix.component }}' + + $tags_array=$( "${{ steps.meta.outputs.tags }}".Split("`r`n") ) + $tags=$( $tags_array | Foreach-Object { "--tag=$_" } ) + + echo "docker build --file=$dockerfile $tags $context" + docker build --label org.opencontainers.image.revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} ` + --label org.opencontainers.image.created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} ` + --build-arg=BUILD_BASE_IMAGE=mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-${{ steps.base_os_tag.outputs.os_tag }} ` + --file=$dockerfile ` + $tags ` + $context + if (-not $?) {throw "Failed"} + + - name: Push image + if: ${{ env.AUTO_PUSH_IMAGES }} + run: | + $tags_array=$( "${{ steps.meta.outputs.tags }}".Split("`r`n") ) + + Foreach ($tag in $tags_array) { + echo "docker image push $tag" + docker image push $tag + if (-not $?) {throw "Failed"} + } + + - name: Image digest + if: ${{ env.AUTO_PUSH_IMAGES }} + run: | + $tags_array=$( "${{ steps.meta.outputs.tags }}".Split("`r`n") ) + + $digest=$(docker inspect $tags_array[0] --format "{{ index .RepoDigests 0}}").Split('@')[-1] + if (-not $?) {throw "Failed"} + + echo $digest + $digest | Set-Content -Path ${{ env.BASE_BUILD_NAME }}${{ env.BASE_BUILD_ARTIFACT_FILE_SUFFIX }} + + - name: Upload SHA256 tag + if: ${{ env.AUTO_PUSH_IMAGES }} + uses: actions/upload-artifact@v2.2.4 + with: + name: ${{ env.BASE_BUILD_NAME }}${{ env.BASE_BUILD_ARTIFACT_FILE_SUFFIX }} + path: ${{ env.BASE_BUILD_NAME }}${{ env.BASE_BUILD_ARTIFACT_FILE_SUFFIX }} + if-no-files-found: error + + - name: Logout from DockerHub + run: | + docker logout + if (-not $?) {throw "Failed"} + + build_components: + timeout-minutes: 70 + needs: [ "build_base", "init_build"] + name: Build ${{ matrix.component }} sources on ${{ matrix.os }} + env: + BASE_BUILD_ARTIFACT_FILE_SUFFIX: "_${{ matrix.os }}_${{ matrix.component }}" + COMPONENT_BASE_BUILD_ARTIFACT_FILE_SUFFIX: "_${{ matrix.os }}_${{ matrix.component }}" + strategy: + fail-fast: false + matrix: + os: ${{ fromJson(needs.init_build.outputs.os) }} + component: ${{ fromJson(needs.init_build.outputs.components) }} + + runs-on: ${{ matrix.os }} + steps: + - name: Checkout repository + uses: actions/checkout@v2.3.4 + + - name: Login to DockerHub + run: | + docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + if (-not $?) {throw "Failed"} + + - name: Base OS tag + id: base_os_tag + run: | + $os_tag=$(Get-Content -Path .\build.json | ConvertFrom-Json).'os-windows'.'${{ matrix.os }}' + echo "::set-output name=os_tag::$os_tag" + + - name: Generate tags + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.DOCKER_REPOSITORY }}/${{ env.IMAGE_PREFIX }}${{ env.COMPONENT_BASE_BUILD_NAME }} + tags: | + type=semver,pattern={{version}},prefix=${{ matrix.component }}-${{ steps.base_os_tag.outputs.os_tag }}- + type=semver,pattern={{version}},suffix=-${{ steps.base_os_tag.outputs.os_tag }},prefix=${{ matrix.component }}- + type=ref,event=branch,prefix=${{ matrix.component }}-${{ steps.base_os_tag.outputs.os_tag }}-,suffix=-latest + type=ref,event=branch,suffix=-${{ steps.base_os_tag.outputs.os_tag }}-latest,prefix=${{ matrix.component }}- + type=raw,enable=${{ needs.init_build.outputs.is_default_branch == 'true' }},value=${{ matrix.component }}-${{ steps.base_os_tag.outputs.os_tag }}-latest + flavor: | + latest=false + + - name: Download SHA256 tag build-base:${{ matrix.os }} + uses: actions/download-artifact@v2.0.10 + with: + name: ${{ env.BASE_BUILD_NAME }}${{ env.BASE_BUILD_ARTIFACT_FILE_SUFFIX }} + + - name: Retrieve ${{ env.BASE_BUILD_NAME }}:${{ matrix.os }} SHA256 tag + id: base_build + run: | + $base_tag = Get-Content ${{ env.BASE_BUILD_NAME }}${{ env.BASE_BUILD_ARTIFACT_FILE_SUFFIX }} -Raw + $build_base_image="${{ env.DOCKER_REPOSITORY }}/${{ env.IMAGE_PREFIX }}${{ env.BASE_BUILD_NAME }}@" + $base_tag + + echo "::set-output name=base_tag::$base_tag" + echo "::set-output name=base_build_image::$build_base_image" + + - name: Build image + id: docker_build + run: | + $context='.\Dockerfiles\${{ env.COMPONENT_BASE_BUILD_NAME }}\windows\' + $dockerfile= $context + 'Dockerfile.${{ matrix.component }}' + + $tags_array=$( "${{ steps.meta.outputs.tags }}".Split("`r`n") ) + $tags=$($tags_array | Foreach-Object { "--tag=$_" }) + + echo "docker build --file=$dockerfile $tags $context" + docker build --label org.opencontainers.image.revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} ` + --label org.opencontainers.image.created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} ` + --file=$dockerfile ` + --build-arg=BUILD_BASE_IMAGE=${{ steps.base_build.outputs.base_build_image }} ` + $tags ` + $context + if (-not $?) {throw "Failed"} + + - name: Push image + if: ${{ env.AUTO_PUSH_IMAGES }} + run: | + $tags_array=$( "${{ steps.meta.outputs.tags }}".Split("`r`n") ) + + Foreach ($tag in $tags_array) { + echo "docker image push $tag" + docker image push $tag + if (-not $?) {throw "Failed"} + } + + - name: Image digest + if: ${{ env.AUTO_PUSH_IMAGES }} + run: | + $tags_array=$( "${{ steps.meta.outputs.tags }}".Split("`r`n") ) + + $digest=$(docker inspect $tags_array[0] --format "{{ index .RepoDigests 0}}").Split('@')[-1] + if (-not $?) {throw "Failed"} + + echo $digest + $digest | Set-Content -Path ${{ env.COMPONENT_BASE_BUILD_NAME }}${{ env.COMPONENT_BASE_BUILD_ARTIFACT_FILE_SUFFIX }} + + - name: Upload SHA256 tag + if: ${{ env.AUTO_PUSH_IMAGES }} + uses: actions/upload-artifact@v2.2.4 + with: + name: ${{ env.COMPONENT_BASE_BUILD_NAME }}${{ env.COMPONENT_BASE_BUILD_ARTIFACT_FILE_SUFFIX }} + path: ${{ env.COMPONENT_BASE_BUILD_NAME }}${{ env.COMPONENT_BASE_BUILD_ARTIFACT_FILE_SUFFIX }} + if-no-files-found: error + + - name: Logout from DockerHub + run: | + docker logout + if (-not $?) {throw "Failed"} + + build_images: + timeout-minutes: 70 + needs: [ "build_components", "init_build"] + name: Build ${{ matrix.component }} on ${{ matrix.os }} + env: + COMPONENT_BASE_BUILD_ARTIFACT_FILE_SUFFIX: "_${{ matrix.os }}_${{ matrix.component }}" + strategy: + fail-fast: false + matrix: + os: ${{ fromJson(needs.init_build.outputs.os) }} + component: ${{ fromJson(needs.init_build.outputs.components) }} + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2.3.4 + + - name: Login to DockerHub + run: | + docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + if (-not $?) {throw "Failed"} + + - name: Base OS tag + id: base_os_tag + run: | + $os_tag=$(Get-Content -Path .\build.json | ConvertFrom-Json).'os-windows'.'${{ matrix.os }}' + echo "::set-output name=os_tag::$os_tag" + + - name: Generate tags + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.DOCKER_REPOSITORY }}/${{ env.IMAGE_PREFIX }}${{ matrix.component }} + tags: | + type=semver,pattern={{version}},prefix=${{ steps.base_os_tag.outputs.os_tag }}- + type=semver,pattern={{version}},suffix=-${{ steps.base_os_tag.outputs.os_tag }} + type=ref,event=branch,prefix=${{ steps.base_os_tag.outputs.os_tag }}-,suffix=-latest + type=ref,event=branch,suffix=-${{ steps.base_os_tag.outputs.os_tag }}-latest + type=raw,enable=${{ needs.init_build.outputs.is_default_branch == 'true' }},value=${{ steps.base_os_tag.outputs.os_tag }}-latest + flavor: | + latest=false + + - name: Download SHA256 tag for ${{ env.COMPONENT_BASE_BUILD_NAME }}:${{ matrix.os }} + uses: actions/download-artifact@v2.0.10 + with: + name: ${{ env.COMPONENT_BASE_BUILD_NAME }}${{ env.COMPONENT_BASE_BUILD_ARTIFACT_FILE_SUFFIX }} + + - name: ${{ env.COMPONENT_BASE_BUILD_NAME }}:${{ matrix.os }} SHA256 tag + id: base_build + run: | + $base_tag = Get-Content ${{ env.COMPONENT_BASE_BUILD_NAME }}${{ env.COMPONENT_BASE_BUILD_ARTIFACT_FILE_SUFFIX }} -Raw + $build_base_image="${{ env.DOCKER_REPOSITORY }}/${{ env.IMAGE_PREFIX }}${{ env.COMPONENT_BASE_BUILD_NAME }}@" + $base_tag + + echo "::set-output name=base_tag::$base_tag" + echo "::set-output name=base_build_image::$build_base_image" + + - name: Build image + id: docker_build + run: | + $context='.\Dockerfiles\${{ matrix.component }}\windows\' + $dockerfile= $context + 'Dockerfile' + + $tags_array=$( "${{ steps.meta.outputs.tags }}".Split("`r`n") ) + $tags=$($tags_array | Foreach-Object { "--tag=$_" }) + + # PowerShell images based on LTSC 2019 and LTSC 2016 do not have "ltsc" prefix + $os_tag_suffix='${{ steps.base_os_tag.outputs.os_tag }}' + $os_tag_suffix=$os_tag_suffix -replace "ltsc2019",'1809' + + echo "docker build --file=$dockerfile $tags $context" + docker build --label org.opencontainers.image.revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} ` + --label org.opencontainers.image.created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} ` + --file=$dockerfile ` + --build-arg=BUILD_BASE_IMAGE=${{ steps.base_build.outputs.base_build_image }} ` + --build-arg=BASE_IMAGE=mcr.microsoft.com/powershell:lts-nanoserver-$os_tag_suffix ` + $tags ` + $context + if (-not $?) {throw "Failed"} + + - name: Push image + if: ${{ env.AUTO_PUSH_IMAGES }} + run: | + $tags_array=$( "${{ steps.meta.outputs.tags }}".Split("`r`n") ) + + Foreach ($tag in $tags_array) { + echo "docker image push $tag" + docker image push $tag + if (-not $?) {throw "Failed"} + } + + - name: Image digest + if: ${{ env.AUTO_PUSH_IMAGES }} + run: | + $tags_array=$( "${{ steps.meta.outputs.tags }}".Split("`r`n") ) + + $digest=$(docker inspect $tags_array[0] --format "{{ index .RepoDigests 0}}").Split('@')[-1] + if (-not $?) {throw "Failed"} + + echo $digest + + - name: Logout from DockerHub + run: | + docker logout + if (-not $?) {throw "Failed"} diff --git a/Dockerfiles/agent/alpine/Dockerfile b/Dockerfiles/agent/alpine/Dockerfile index fd55a10b8..acf71b9dd 100644 --- a/Dockerfiles/agent/alpine/Dockerfile +++ b/Dockerfiles/agent/alpine/Dockerfile @@ -1,14 +1,36 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:alpine-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM alpine:3.12 +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix agent" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix agent is deployed on a monitoring target to actively monitor local resources and applications" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd", "/usr/sbin/zabbix_agentd"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_agentd.conf", "/etc/zabbix/zabbix_agentd.conf"] + RUN set -eux && \ addgroup --system --gid 1995 zabbix && \ adduser --system \ @@ -34,60 +56,9 @@ RUN set -eux && \ pcre \ libcurl \ libldap && \ - rm -rf /var/cache/apk/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - apk add --no-cache --virtual build-dependencies \ - autoconf \ - automake \ - curl-dev \ - openssl-dev \ - openldap-dev \ - g++ \ - pcre-dev \ - make \ - git && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --prefix=/usr \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-agent \ - --with-libcurl \ - --with-ldap \ - --with-openssl \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd /usr/sbin/zabbix_agentd && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp /tmp/zabbix-${ZBX_VERSION}/conf/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - apk del --purge --no-network \ - build-dependencies && \ rm -rf /var/cache/apk/* EXPOSE 10050/TCP diff --git a/Dockerfiles/agent/centos/Dockerfile b/Dockerfiles/agent/centos/Dockerfile index f21aa6c6c..e08ac38dc 100644 --- a/Dockerfiles/agent/centos/Dockerfile +++ b/Dockerfiles/agent/centos/Dockerfile @@ -1,27 +1,37 @@ -FROM centos:centos8 +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:centos-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + +FROM centos:8 + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} LABEL org.opencontainers.image.title="Zabbix agent" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix agent is deployed on a monitoring target to actively monitor local resources and applications" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM -ENV TINI_VERSION=v0.19.0 +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd", "/usr/sbin/zabbix_agentd"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_agentd.conf", "/etc/zabbix/zabbix_agentd.conf"] RUN set -eux && \ - ARCH_SUFFIX="$(arch)"; \ - case "$ARCH_SUFFIX" in \ - i686) export ARCH_SUFFIX='i386' ;; \ - x86_64) [ -f /lib64/ld-linux-x86-64.so.2 ] && export ARCH_SUFFIX='amd64' || export ARCH_SUFFIX='i386' ;; \ - aarch64) export ARCH_SUFFIX='arm64' ;; \ - armv7l) export ARCH_SUFFIX='armhf' ;; \ - ppc64el|ppc64le) export ARCH_SUFFIX='ppc64le' ;; \ - s390x) export ARCH_SUFFIX='s390x' ;; \ - *) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \ - esac; \ groupadd --system --gid 1995 zabbix && \ useradd \ --system --comment "Zabbix monitoring system" \ @@ -35,83 +45,27 @@ RUN set -eux && \ mkdir -p /var/lib/zabbix && \ mkdir -p /var/lib/zabbix/enc && \ mkdir -p /var/lib/zabbix/modules && \ - dnf --quiet makecache && \ - dnf -y install --setopt=tsflags=nodocs --setopt=install_weak_deps=False --best \ - libcurl-minimal \ - zlib \ + REPOLIST="baseos,appstream,epel" && \ + INSTALL_PKGS="bash \ + tini \ tzdata \ - openssl-libs && \ - curl -L "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${ARCH_SUFFIX}" -o /sbin/tini && \ - curl -L "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${ARCH_SUFFIX}.asc" -o /tmp/tini.asc && \ - export GNUPGHOME="$(mktemp -d)" && \ - for server in $(shuf -e ha.pool.sks-keyservers.net \ - hkp://p80.pool.sks-keyservers.net:80 \ - ipv4.pool.sks-keyservers.net \ - keyserver.ubuntu.com \ - keyserver.pgp.com \ - pgp.mit.edu) ; do \ - gpg --keyserver "$server" --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 && break || : ; \ - done && \ - gpg --batch --verify /tmp/tini.asc /sbin/tini && \ - rm -rf "$GNUPGHOME" /tmp/tini.asc && \ - chmod +x /sbin/tini && \ - dnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - dnf --quiet makecache && \ - dnf -y install --setopt=tsflags=nodocs --setopt=install_weak_deps=False --best \ - autoconf \ - automake \ - pcre-devel \ - libcurl-devel \ - make \ - openssl-devel \ - openldap-devel \ - git \ - gcc && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --prefix=/usr \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-agent \ - --with-libcurl \ - --with-ldap \ - --with-openssl \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd /usr/sbin/zabbix_agentd && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp /tmp/zabbix-${ZBX_VERSION}/conf/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ - dnf -y history undo `dnf -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ - dnf -y clean all && \ + iputils \ + pcre \ + libcurl-minimal \ + openssl-libs \ + zlib" && \ + dnf -y install epel-release && \ + dnf -y install \ + --disablerepo "*" \ + --enablerepo "${REPOLIST}" \ + --setopt=tsflags=nodocs \ + --setopt=install_weak_deps=False \ + --best \ + ${INSTALL_PKGS} && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ + dnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki @@ -121,7 +75,7 @@ WORKDIR /var/lib/zabbix COPY ["docker-entrypoint.sh", "/usr/bin/"] -ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/docker-entrypoint.sh"] +ENTRYPOINT ["/usr/bin/tini", "--", "/usr/bin/docker-entrypoint.sh"] USER 1997 diff --git a/Dockerfiles/agent/ol/Dockerfile b/Dockerfiles/agent/ol/Dockerfile index 5732edaa2..0b9cf5654 100644 --- a/Dockerfiles/agent/ol/Dockerfile +++ b/Dockerfiles/agent/ol/Dockerfile @@ -1,14 +1,35 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix agent" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix agent is deployed on a monitoring target to actively monitor local resources and applications" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd", "/usr/sbin/zabbix_agentd"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_agentd.conf", "/etc/zabbix/zabbix_agentd.conf"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -33,70 +54,18 @@ RUN set -eux && \ libcurl \ openssl-libs \ zlib" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ - microdnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && REPOLIST="ol8_baseos_latest,ol8_appstream" && \ - INSTALL_PKGS="autoconf \ - automake \ - pcre-devel \ - libcurl-devel \ - make \ - openssl-devel \ - openldap-devel \ - git \ - gcc" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --prefix=/usr \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-agent \ - --with-libcurl \ - --with-ldap \ - --with-openssl \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd /usr/sbin/zabbix_agentd && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp /tmp/zabbix-${ZBX_VERSION}/conf/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ + microdnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/agent/ubuntu/Dockerfile b/Dockerfiles/agent/ubuntu/Dockerfile index 6bbb2bbea..2945a6a21 100644 --- a/Dockerfiles/agent/ubuntu/Dockerfile +++ b/Dockerfiles/agent/ubuntu/Dockerfile @@ -1,25 +1,37 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ubuntu-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM ubuntu:focal +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix agent" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix agent is deployed on a monitoring target to actively monitor local resources and applications" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd", "/usr/sbin/zabbix_agentd"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_agentd.conf", "/etc/zabbix/zabbix_agentd.conf"] + RUN set -eux && \ - ARCH_SUFFIX="$(arch)"; \ - case "$ARCH_SUFFIX" in \ - i686) export ARCH_SUFFIX='i386' ;; \ - x86_64) [ -f /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ] && export ARCH_SUFFIX='amd64' || export ARCH_SUFFIX='i386' ;; \ - aarch64) export ARCH_SUFFIX='arm64' ;; \ - armv7l) export ARCH_SUFFIX='armhf' ;; \ - ppc64el|ppc64le) export ARCH_SUFFIX='ppc64le' ;; \ - s390x) export ARCH_SUFFIX='s390x' ;; \ - *) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \ - esac; \ echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d && \ groupadd --system --gid 1995 zabbix && \ useradd \ @@ -42,70 +54,6 @@ RUN set -eux && \ libssl1.1 \ libcurl4 \ libldap-2.4 && \ - apt-get -y autoremove && \ - apt-get -y clean && \ - rm -rf /var/lib/apt/lists/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - apt-get -y update && \ - DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \ - autoconf \ - automake \ - libcurl4-openssl-dev \ - libc6-dev \ - libldap2-dev \ - libpcre3-dev \ - libssl-dev \ - make \ - pkg-config \ - git \ - gcc && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-agent \ - --with-libcurl \ - --with-ldap \ - --with-openssl \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd /usr/sbin/zabbix_agentd && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp /tmp/zabbix-${ZBX_VERSION}/conf/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ - apt-get -y purge \ - autoconf \ - automake \ - libcurl4-openssl-dev \ - libc6-dev \ - libldap2-dev \ - libssl-dev \ - make \ - pkg-config \ - git \ - gcc && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ diff --git a/Dockerfiles/agent/windows/Dockerfile b/Dockerfiles/agent/windows/Dockerfile new file mode 100644 index 000000000..c3bb1dce3 --- /dev/null +++ b/Dockerfiles/agent/windows/Dockerfile @@ -0,0 +1,63 @@ +# syntax=docker/dockerfile:1 +# escape=` +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-agent:ltsc2022-agent-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git +ARG BASE_IMAGE=mcr.microsoft.com/powershell:lts-nanoserver-ltsc2022 + +FROM ${BUILD_BASE_IMAGE} as builder + +FROM $BASE_IMAGE + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +LABEL org.opencontainers.image.title="Zabbix agent" ` + org.opencontainers.image.authors="Alexey Pustovalov " ` + org.opencontainers.image.vendor="Zabbix LLC" ` + org.opencontainers.image.url="https://zabbix.com/" ` + org.opencontainers.image.description="Zabbix agent is deployed on a monitoring target to actively monitor local resources and applications" ` + org.opencontainers.image.licenses="GPL v2.0" ` + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" ` + org.opencontainers.image.version="${ZBX_VERSION}" ` + org.opencontainers.image.source="${ZBX_SOURCES}" + +SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop';"] + +WORKDIR C:\zabbix\ + +COPY --from=builder ["C:\\zabbix", "C:\\zabbix"] +COPY [".\\docker-entrypoint.ps1", "C:\\zabbix"] + +USER ContainerAdministrator + +RUN $env:PATH = [string]::Format('{0}\zabbix\sbin;{0}\zabbix\bin;', $env:SystemDrive) + $env:PATH; ` + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); ` + ` + $env:ZBX_HOME = [string]::Format('{0}\zabbix', $env:SystemDrive); ` + [Environment]::SetEnvironmentVariable('ZBX_HOME', $env:ZBX_HOME, [EnvironmentVariableTarget]::Machine); + +RUN Set-Location -Path $env:SystemDrive\.; ` + ` + New-Item -ItemType directory -Path $env:ZBX_HOME\conf\zabbix_agentd.d | Out-Null; ` + New-Item -ItemType directory -Path $env:ZBX_HOME\enc | Out-Null; ` + New-Item -ItemType directory -Path $env:ZBX_HOME\modules | Out-Null; ` + New-Item -ItemType directory -Path $env:ZBX_HOME\buffer | Out-Null; ` + ` + net user /add zabbix; ` + $acl = Get-Acl -Path $env:ZBX_HOME; ` + $ace = New-Object Security.AccessControl.FileSystemAccessRule ('zabbix', 'Modify', 'ContainerInherit, ObjectInherit', 'InheritOnly', 'Allow'); ` + $acl.AddAccessRule($ace); ` + Set-Acl -AclObject $acl -Path $env:ZBX_HOME; + +USER zabbix + +EXPOSE 10050/TCP + +CMD C:\zabbix\docker-entrypoint.ps1 C:\zabbix\sbin\zabbix_agentd.exe -c C:\zabbix\conf\zabbix_agentd.win.conf -f diff --git a/Dockerfiles/agent/windows/docker-entrypoint.ps1 b/Dockerfiles/agent/windows/docker-entrypoint.ps1 new file mode 100644 index 000000000..094345231 --- /dev/null +++ b/Dockerfiles/agent/windows/docker-entrypoint.ps1 @@ -0,0 +1,220 @@ + +# Script trace mode +if ($env:DEBUG_MODE -eq "true") { + Set-PSDebug -trace 1 +} + +# Default Zabbix installation name +# Default Zabbix server host +if ([string]::IsNullOrWhitespace($env:ZBX_SERVER_HOST)) { + $env:ZBX_SERVER_HOST="zabbix-server" +} +# Default Zabbix server port number +if ([string]::IsNullOrWhitespace($env:ZBX_SERVER_PORT)) { + $env:ZBX_SERVER_PORT="10051" +} + + +# Default directories +# User 'zabbix' home directory +$ZabbixUserHomeDir="C:\zabbix" +# Configuration files directory +$ZabbixConfigDir="C:\zabbix\conf" + +function Update-Config-Var { + Param ( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] $ConfigPath, + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [string]$VarName, + [Parameter(Mandatory=$false, Position=2)] + [string]$VarValue = $null, + [Parameter(Mandatory=$false, Position=3)] + [bool]$IsMultiple + ) + + $MaskList = "TLSPSKIdentity" + + if (-not(Test-Path -Path $ConfigPath -PathType Leaf)) { + throw "**** Configuration file '$ConfigPath' does not exist" + } + + if ($MaskList.Contains($VarName) -eq $true -And [string]::IsNullOrWhitespace($VarValue) -ne $true) { + Write-Host -NoNewline "** Updating '$ConfigPath' parameter ""$VarName"": '****'. Enable DEBUG_MODE to view value ..." + } + else { + Write-Host -NoNewline "** Updating '$ConfigPath' parameter ""$VarName"": '$VarValue'..." + } + + if ([string]::IsNullOrWhitespace($VarValue)) { + if ((Get-Content $ConfigPath | %{$_ -match "^$VarName="}) -contains $true) { + (Get-Content $ConfigPath) | + Where-Object {$_ -notmatch "^$VarName=" } | + Set-Content $ConfigPath + } + + Write-Host "removed" + return + } + + if ($VarValue -eq '""') { + (Get-Content $ConfigPath) | Foreach-Object { $_ -Replace "^($VarName=)(.*)", '$1' } | Set-Content $ConfigPath + Write-Host "undefined" + return + } + + if ($VarName -match '^TLS.*File$') { + $VarValue="$ZabbixUserHomeDir\enc\$VarValue" + } + + if ((Get-Content $ConfigPath | %{$_ -match "^$VarName="}) -contains $true -And $IsMultiple -ne $true) { + (Get-Content $ConfigPath) | Foreach-Object { $_ -Replace "^$VarName=.+", "$VarName=$VarValue" } | Set-Content $ConfigPath + + Write-Host updated + } + elseif ((Get-Content $ConfigPath | select-string -pattern "^[#;] $VarName=").length -gt 0) { + (Get-Content $ConfigPath) | + Foreach-Object { + $_ + if ($_ -match "^[#;] $VarName=") { + "$VarName=$VarValue" + } + } | Set-Content $ConfigPath + + Write-Host "added" + } + else { + Add-Content -Path $ConfigPath -Value "$VarName=$VarValue" + Write-Host "added at the end" + } +} + +function Update-Config-Multiple-Var { + Param ( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] $ConfigPath, + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [string]$VarName, + [Parameter(Mandatory=$false, Position=2)] + [string]$VarValue = $null + ) + + foreach ($value in $VarValue.split(',')) { + Update-Config-Var $ConfigPath $VarName $value $true + } +} + +function Prepare-Zbx-Agent-Config { + Write-Host "** Preparing Zabbix agent configuration file" + + $ZbxAgentConfig="$ZabbixConfigDir\zabbix_agentd.win.conf" + + if ([string]::IsNullOrWhitespace($env:ZBX_PASSIVESERVERS)) { + $env:ZBX_PASSIVESERVERS="" + } + else { + $env:ZBX_PASSIVESERVERS=",$env:ZBX_PASSIVESERVERS" + } + + $env:ZBX_PASSIVESERVERS=$env:ZBX_SERVER_HOST + $env:ZBX_PASSIVESERVERS + + if ([string]::IsNullOrWhitespace($env:ZBX_ACTIVESERVERS)) { + $env:ZBX_ACTIVESERVERS="" + } + else { + $env:ZBX_ACTIVESERVERS=",$env:ZBX_ACTIVESERVERS" + } + + $env:ZBX_ACTIVESERVERS=$env:ZBX_SERVER_HOST + ":" + $env:ZBX_SERVER_PORT + $env:ZBX_ACTIVESERVERS + + Update-Config-Var $ZbxAgentConfig "LogType" "console" + Update-Config-Var $ZbxAgentConfig "LogFile" + Update-Config-Var $ZbxAgentConfig "LogFileSize" + Update-Config-Var $ZbxAgentConfig "DebugLevel" "$env:ZBX_DEBUGLEVEL" + Update-Config-Var $ZbxAgentConfig "SourceIP" + Update-Config-Var $ZbxAgentConfig "LogRemoteCommands" "$env:ZBX_LOGREMOTECOMMANDS" + + if ([string]::IsNullOrWhitespace($env:ZBX_PASSIVE_ALLOW)) { + $env:ZBX_PASSIVE_ALLOW="true" + } + + if ($env:ZBX_PASSIVE_ALLOW -eq "true") { + Write-Host "** Using '$env:ZBX_PASSIVESERVERS' servers for passive checks" + Update-Config-Var $ZbxAgentConfig "Server" "$env:ZBX_PASSIVESERVERS" + } + else { + Update-Config-Var $ZbxAgentConfig "Server" + } + + Update-Config-Var $ZbxAgentConfig "ListenPort" "$env:ZBX_LISTENPORT" + Update-Config-Var $ZbxAgentConfig "ListenIP" "$env:ZBX_LISTENIP" + Update-Config-Var $ZbxAgentConfig "StartAgents" "$env:ZBX_STARTAGENTS" + + if ([string]::IsNullOrWhitespace($env:ZBX_ACTIVE_ALLOW)) { + $env:ZBX_ACTIVE_ALLOW="true" + } + + if ($env:ZBX_PASSIVE_ALLOW -eq "true") { + Write-Host "** Using '$env:ZBX_ACTIVESERVERS' servers for active checks" + Update-Config-Var $ZbxAgentConfig "ServerActive" "$env:ZBX_ACTIVESERVERS" + } + else { + Update-Config-Var $ZbxAgentConfig "ServerActive" + } + + Update-Config-Var $ZbxAgentConfig "HostInterface" "$env:ZBX_HOSTINTERFACE" + Update-Config-Var $ZbxAgentConfig "HostInterfaceItem" "$env:ZBX_HOSTINTERFACEITEM" + + Update-Config-Var $ZbxAgentConfig "Hostname" "$env:ZBX_HOSTNAME" + Update-Config-Var $ZbxAgentConfig "HostnameItem" "$env:ZBX_HOSTNAMEITEM" + Update-Config-Var $ZbxAgentConfig "HostMetadata" "$env:ZBX_METADATA" + Update-Config-Var $ZbxAgentConfig "HostMetadataItem" "$env:ZBX_METADATAITEM" + Update-Config-Var $ZbxAgentConfig "RefreshActiveChecks" "$env:ZBX_REFRESHACTIVECHECKS" + Update-Config-Var $ZbxAgentConfig "BufferSend" "$env:ZBX_BUFFERSEND" + Update-Config-Var $ZbxAgentConfig "BufferSize" "$env:ZBX_BUFFERSIZE" + Update-Config-Var $ZbxAgentConfig "MaxLinesPerSecond" "$env:ZBX_MAXLINESPERSECOND" + # Please use include to enable Alias feature +# update_config_multiple_var $ZBX_AGENT_CONFIG "Alias" $env:ZBX_ALIAS + # Please use include to enable Perfcounter feature +# update_config_multiple_var $ZBX_AGENT_CONFIG "PerfCounter" $env:ZBX_PERFCOUNTER + Update-Config-Var $ZbxAgentConfig "Timeout" "$env:ZBX_TIMEOUT" + Update-Config-Var $ZbxAgentConfig "Include" "$ZabbixConfigDir\zabbix_agentd.d\" + Update-Config-Var $ZbxAgentConfig "UnsafeUserParameters" "$env:ZBX_UNSAFEUSERPARAMETERS" + Update-Config-Var $ZbxAgentConfig "TLSConnect" "$env:ZBX_TLSCONNECT" + Update-Config-Var $ZbxAgentConfig "TLSAccept" "$env:ZBX_TLSACCEPT" + Update-Config-Var $ZbxAgentConfig "TLSCAFile" "$env:ZBX_TLSCAFILE" + Update-Config-Var $ZbxAgentConfig "TLSCRLFile" "$env:ZBX_TLSCRLFILE" + Update-Config-Var $ZbxAgentConfig "TLSServerCertIssuer" "$env:ZBX_TLSSERVERCERTISSUER" + Update-Config-Var $ZbxAgentConfig "TLSServerCertSubject" "$env:ZBX_TLSSERVERCERTSUBJECT" + Update-Config-Var $ZbxAgentConfig "TLSCertFile" "$env:ZBX_TLSCERTFILE" + Update-Config-Var $ZbxAgentConfig "TLSKeyFile" "$env:ZBX_TLSKEYFILE" + Update-Config-Var $ZbxAgentConfig "TLSPSKIdentity" "$env:ZBX_TLSPSKIDENTITY" + Update-Config-Var $ZbxAgentConfig "TLSPSKFile" "$env:ZBX_TLSPSKFILE" + + Update-Config-Multiple-Var $ZbxAgentConfig "DenyKey" "$env:ZBX_DENYKEY" + Update-Config-Multiple-Var $ZbxAgentConfig "AllowKey" "$env:ZBX_ALLOWKEY" + +} + +function PrepareAgent { + Write-Host "** Preparing Zabbix agent" + Prepare-Zbx-Agent-Config +} + +$commandArgs=$args + +if ($args.length -gt 0 -And $args[0].Substring(0, 1) -eq '-') { + $commandArgs = "C:\zabbix\sbin\zabbix_agentd.exe " + $commandArgs +} + +if ($args.length -gt 0 -And $args[0] -eq "C:\zabbix\sbin\zabbix_agentd.exe") { + PrepareAgent +} + +if ($args.length -gt 0) { + Invoke-Expression "$CommandArgs" +} diff --git a/Dockerfiles/agent2/alpine/Dockerfile b/Dockerfiles/agent2/alpine/Dockerfile index c159139eb..4589fdf07 100644 --- a/Dockerfiles/agent2/alpine/Dockerfile +++ b/Dockerfiles/agent2/alpine/Dockerfile @@ -1,14 +1,36 @@ -FROM alpine:3.14 +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:alpine-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + +FROM alpine:3.12 + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} LABEL org.opencontainers.image.title="Zabbix agent 2" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix agent 2 is deployed on a monitoring target to actively monitor local resources and applications" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2", "/usr/sbin/zabbix_agent2"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.conf", "/etc/zabbix/zabbix_agent2.conf"] + RUN set -eux && \ addgroup --system --gid 1995 zabbix && \ adduser --system \ @@ -32,64 +54,11 @@ RUN set -eux && \ bash \ pcre \ coreutils \ + libcurl \ iputils && \ - rm -rf /var/cache/apk/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - apk add --no-cache --virtual build-dependencies \ - autoconf \ - automake \ - go \ - g++ \ - make \ - git \ - pcre-dev \ - openssl-dev \ - zlib-dev && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/go/pkg/version/version.go && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - export GOPATH=/tmp/zabbix-${ZBX_VERSION}/go && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --prefix=/usr \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --with-openssl \ - --enable-ipv6 \ - --enable-agent2 \ - --enable-agent \ - --silent && \ - make -j"$(nproc)" -s && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 /usr/sbin/zabbix_agent2 && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.conf /etc/zabbix/zabbix_agent2.conf && \ - strip /usr/sbin/zabbix_agent2 && \ - strip /usr/bin/zabbix_get && \ - strip /usr/bin/zabbix_sender && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - apk del --purge --no-network \ - build-dependencies && \ rm -rf /var/cache/apk/* EXPOSE 10050/TCP 31999/TCP diff --git a/Dockerfiles/agent2/alpine/README.md b/Dockerfiles/agent2/alpine/README.md index 1e32848d1..ca33c13f5 100644 --- a/Dockerfiles/agent2/alpine/README.md +++ b/Dockerfiles/agent2/alpine/README.md @@ -188,11 +188,11 @@ This variant is highly recommended when final image size being as small as possi To minimize image size, it's uncommon for additional related tools (such as `git` or `bash`) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the [`alpine` image description](https://hub.docker.com/_/alpine/) for examples of how to install packages if you are unfamiliar). -## `zabbix-agent:ubuntu-` +## `zabbix-agent2:ubuntu-` This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of. -## `zabbix-agent:ol-` +## `zabbix-agent2:ol-` Oracle Linux is an open-source operating system available under the GNU General Public License (GPLv2). Suitable for general purpose or Oracle workloads, it benefits from rigorous testing of more than 128,000 hours per day with real-world workloads and includes unique innovations such as Ksplice for zero-downtime kernel patching, DTrace for real-time diagnostics, the powerful Btrfs file system, and more. diff --git a/Dockerfiles/agent2/centos/.dockerignore b/Dockerfiles/agent2/centos/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/Dockerfiles/agent2/centos/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/Dockerfiles/agent2/centos/Dockerfile b/Dockerfiles/agent2/centos/Dockerfile new file mode 100644 index 000000000..e2cd61337 --- /dev/null +++ b/Dockerfiles/agent2/centos/Dockerfile @@ -0,0 +1,84 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:centos-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + +FROM centos:8 + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + +LABEL org.opencontainers.image.title="Zabbix agent 2" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix agent 2 is deployed on a monitoring target to actively monitor local resources and applications" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +STOPSIGNAL SIGTERM + +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2", "/usr/sbin/zabbix_agent2"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.conf", "/etc/zabbix/zabbix_agent2.conf"] + +RUN set -eux && \ + groupadd --system --gid 1995 zabbix && \ + useradd \ + --system --comment "Zabbix monitoring system" \ + -g zabbix -G root \ + --uid 1997 \ + --shell /sbin/nologin \ + --home-dir /var/lib/zabbix/ \ + zabbix && \ + mkdir -p /etc/zabbix && \ + mkdir -p /etc/zabbix/zabbix_agentd.d && \ + mkdir -p /var/lib/zabbix && \ + mkdir -p /var/lib/zabbix/enc && \ + mkdir -p /var/lib/zabbix/modules && \ + mkdir -p /var/lib/zabbix/buffer && \ + REPOLIST="baseos,appstream,epel" && \ + INSTALL_PKGS="bash \ + tini \ + tzdata \ + iputils \ + pcre \ + libcurl-minimal \ + openssl-libs" && \ + dnf -y install epel-release && \ + dnf -y install \ + --disablerepo "*" \ + --enablerepo "${REPOLIST}" \ + --setopt=tsflags=nodocs \ + --setopt=install_weak_deps=False \ + --best \ + ${INSTALL_PKGS} && \ + chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ + chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ + chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ + dnf -y clean all && \ + rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ + rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki + +EXPOSE 10050/TCP 31999/TCP + +WORKDIR /var/lib/zabbix + +VOLUME ["/var/lib/zabbix/enc"] + +COPY ["docker-entrypoint.sh", "/usr/bin/"] + +ENTRYPOINT ["/usr/bin/tini", "--", "/usr/bin/docker-entrypoint.sh"] + +USER 1997 + +CMD ["/usr/sbin/zabbix_agent2", "--foreground", "-c", "/etc/zabbix/zabbix_agent2.conf"] diff --git a/Dockerfiles/agent2/centos/README.md b/Dockerfiles/agent2/centos/README.md new file mode 100644 index 000000000..ca33c13f5 --- /dev/null +++ b/Dockerfiles/agent2/centos/README.md @@ -0,0 +1,225 @@ +![logo](https://assets.zabbix.com/img/logo/zabbix_logo_500x131.png) + +# What is Zabbix? + +Zabbix is an enterprise-class open source distributed monitoring solution. + +Zabbix is software that monitors numerous parameters of a network and the health and integrity of servers. Zabbix uses a flexible notification mechanism that allows users to configure e-mail based alerts for virtually any event. This allows a fast reaction to server problems. Zabbix offers excellent reporting and data visualisation features based on the stored data. This makes Zabbix ideal for capacity planning. + +For more information and related downloads for Zabbix components, please visit https://hub.docker.com/u/zabbix/ and https://zabbix.com + +# What is Zabbix agent 2? + +Zabbix agent 2 is deployed on a monitoring target to actively monitor local resources and applications (hard drives, memory, processor statistics etc). + +# Zabbix agent 2 images + +These are the only official Zabbix agent 2 Docker images. They are based on Alpine Linux v3.12 images. The available versions of Zabbix agent 2 are: + + Zabbix agent 2 4.4 (tags: alpine-4.4-latest) (unsupported) + Zabbix agent 2 4.4.* (tags: alpine-4.4.*) (unsupported) + Zabbix agent 2 5.0 (tags: alpine-5.0-latest, ubuntu-5.0-latest, ol-5.0-latest) + Zabbix agent 2 5.0.* (tags: alpine-5.0.*, ubuntu-5.0.*, ol-5.0.*) + Zabbix agent 2 5.2 (tags: alpine-5.2-latest, ubuntu-5.2-latest, ol-5.2-latest) + Zabbix agent 2 5.2.* (tags: alpine-5.2.*, ubuntu-5.2.*, ol-5.2.*) + Zabbix agent 2 5.4 (tags: alpine-5.4-latest, ubuntu-5.4-latest, ol-5.4-latest, alpine-latest, ubuntu-latest, ol-latest, latest) + Zabbix agent 2 5.4.* (tags: alpine-5.4.*, ubuntu-5.4.*, ol-5.4.*) + Zabbix agent 2 6.0 (tags: alpine-trunk, ubuntu-trunk, ol-trunk) + +Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux. + +# How to use this image + +## Start `zabbix-agent2` + +Start a Zabbix agent 2 container as follows: + + docker run --name some-zabbix-agent -e ZBX_HOSTNAME="some-hostname" -e ZBX_SERVER_HOST="some-zabbix-server" -d zabbix/zabbix-agent2:tag + +Where `some-zabbix-agent2` is the name you want to assign to your container, `some-hostname` is the hostname, it is Hostname parameter in Zabbix agent 2 configuration file, `some-zabbix-server` is IP or DNS name of Zabbix server or proxy and `tag` is the tag specifying the version you want. See the list above for relevant tags, or look at the [full list of tags](https://hub.docker.com/r/zabbix/zabbix-agent2/tags/). + +## Connects from Zabbix server or Zabbix proxy in other containers (Passive checks) + +This image exposes the standard Zabbix agent 2 port (``10050``) to perform passive checks, so container linking makes Zabbix agent 2 instance available to Zabbix server and Zabbix proxy containers. Start your application container like this in order to link it to the Zabbix agent 2 container: + +```console +$ docker run --name some-zabbix-server --link some-zabbix-agent:zabbix-agent2 -d zabbix/zabbix-server:latest +``` + +## Connect to Zabbix server or Zabbix proxy containers (Active checks) + +This image supports perform active checks, so container linking makes Zabbix server and Zabbix proxy containers available to Zabbix agent 2 instance. Start your application container like this in order to link Zabbix agent 2 to Zabbix server or Zabbix proxy containterns: + +```console +$ docker run --name some-zabbix-agent --link some-zabbix-server:zabbix-server -d zabbix/zabbix-agent2:latest +``` + +## Container shell access and viewing Zabbix agent 2 logs + +The `docker exec` command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your `zabbix-agent2` container: + +```console +$ docker exec -ti some-zabbix-agent /bin/bash +``` + +The Zabbix agent 2 log is available through Docker's container log: + +```console +$ docker logs some-zabbix-agent +``` + +## Privileged mode + +By default, Docker containers are "unprivileged" and do not have access to the most of host resources. Zabbix agent 2 is designed to monitor system resources, to do that Zabbix agent 2 container must be privileged or you may mount some system-wide volumes. For example: + +```console +$ docker run --name some-zabbix-agent --link some-zabbix-server:zabbix-server --privileged -d zabbix/zabbix-agent2:latest +``` +```console +$ docker run --name some-zabbix-agent --link some-zabbix-server:zabbix-server -v /dev/sdc:/dev/sdc -d zabbix/zabbix-agent2:latest +``` + +## Environment Variables + +When you start the `zabbix-agent2` image, you can adjust the configuration of the Zabbix agent 2 by passing one or more environment variables on the `docker run` command line. + +### `ZBX_HOSTNAME` + +This variable is unique, case sensitive hostname. By default, value is `hostname` of the container. It is ``Hostname`` parameter in ``zabbix_agent2.conf``. + +### `ZBX_SERVER_HOST` + +This variable is IP or DNS name of Zabbix server or Zabbix proxy. By default, value is `zabbix-server`. It is ``Server`` parameter in ``zabbix_agent2.conf``. It is allowed to specify Zabbix server or Zabbix proxy port number using ``ZBX_SERVER_PORT`` variable. It make sense in case of non-default port for active checks. + +### `ZBX_PASSIVE_ALLOW` + +This variable is boolean (``true`` or ``false``) and enables or disables feature of passive checks. By default, value is `true`. + +### `ZBX_PASSIVESERVERS` + +The variable is comma separated list of allowed Zabbix server or proxy hosts for connections to Zabbix agent 2 container. + +### `ZBX_ACTIVE_ALLOW` + +This variable is boolean (``true`` or ``false``) and enables or disables feature of active checks. By default, value is `true`. + +### `ZBX_ACTIVESERVERS` + +The variable is comma separated list of allowed Zabbix server or proxy hosts for connections to Zabbix agent 2 container. You may specify port of Zabbix server or Zabbix proxy in such syntax: ``zabbix-server:10061,zabbix-proxy:10072``. + +### `ZBX_DEBUGLEVEL` + +The variable is used to specify debug level. By default, value is ``3``. It is ``DebugLevel`` parameter in ``zabbix_agent2.conf``. Allowed values are listed below: +- ``0`` - basic information about starting and stopping of Zabbix processes; +- ``1`` - critical information +- ``2`` - error information +- ``3`` - warnings +- ``4`` - for debugging (produces lots of information) +- ``5`` - extended debugging (produces even more information) + +### `ZBX_TIMEOUT` + +The variable is used to specify timeout for processing checks. By default, value is ``3``. + +### Other variables + +Additionally the image allows to specify many other environment variables listed below: + +``` +ZBX_ENABLEPERSISTENTBUFFER=false # Available since 5.0.0 +ZBX_PERSISTENTBUFFERPERIOD=1h # Available since 5.0.0 +ZBX_ENABLESTATUSPORT= +ZBX_SOURCEIP= +ZBX_ENABLEREMOTECOMMANDS=0 # Deprecated since 5.0.0 +ZBX_LOGREMOTECOMMANDS=0 +ZBX_STARTAGENTS=3 +ZBX_HOSTNAMEITEM=system.hostname +ZBX_METADATA= +ZBX_METADATAITEM= +ZBX_REFRESHACTIVECHECKS=120 +ZBX_BUFFERSEND=5 +ZBX_BUFFERSIZE=100 +ZBX_MAXLINESPERSECOND=20 +ZBX_LISTENIP= +ZBX_UNSAFEUSERPARAMETERS=0 +ZBX_TLSCONNECT=unencrypted +ZBX_TLSACCEPT=unencrypted +ZBX_TLSCAFILE= +ZBX_TLSCRLFILE= +ZBX_TLSSERVERCERTISSUER= +ZBX_TLSSERVERCERTSUBJECT= +ZBX_TLSCERTFILE= +ZBX_TLSKEYFILE= +ZBX_TLSPSKIDENTITY= +ZBX_TLSPSKFILE= +ZBX_DENYKEY=system.run[*] # Available since 5.0.0 +ZBX_ALLOWKEY= # Available since 5.0.0 +``` + +Default values of these variables are specified after equal sign. + +The allowed variables are identical of parameters in official ``zabbix_agent2.conf`` configuration file. For example, ``ZBX_REFRESHACTIVECHECKS`` = ``RefreshActiveChecks``. + +Please use official documentation for [``zabbix_agent2.conf``](https://www.zabbix.com/documentation/current/manual/appendix/config/zabbix_agent2) to get more information about the variables. + +## Allowed volumes for the Zabbix agent 2 container + +### ``/etc/zabbix/zabbix_agentd.d`` + +The volume allows include ``*.conf`` files and extend Zabbix agent 2 using ``UserParameter`` feature. + +### ``/var/lib/zabbix/enc`` + +The volume is used to store TLS related files. These file names are specified using ``ZBX_TLSCAFILE``, ``ZBX_TLSCRLFILE``, ``ZBX_TLSKEY_FILE`` and ``ZBX_TLSPSKFILE`` variables. + +### ``/var/lib/zabbix/buffer`` + +The volume is used to store the file, where Zabbix Agent2 should keep SQLite database. To enable the feature specify ``ZBX_ENABLEPERSISTENTBUFFER=true``. Available since 5.0.0. + +# The image variants + +The `zabbix-agent2` images come in many flavors, each designed for a specific use case. + +## `zabbix-agent2:alpine-` + +This image is based on the popular [Alpine Linux project](http://alpinelinux.org), available in [the `alpine` official image](https://hub.docker.com/_/alpine). Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general. + +This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use [musl libc](http://www.musl-libc.org) instead of [glibc and friends](http://www.etalabs.net/compare_libcs.html), so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice. See [this Hacker News comment thread](https://news.ycombinator.com/item?id=10782897) for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images. + +To minimize image size, it's uncommon for additional related tools (such as `git` or `bash`) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the [`alpine` image description](https://hub.docker.com/_/alpine/) for examples of how to install packages if you are unfamiliar). + +## `zabbix-agent2:ubuntu-` + +This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of. + +## `zabbix-agent2:ol-` + +Oracle Linux is an open-source operating system available under the GNU General Public License (GPLv2). Suitable for general purpose or Oracle workloads, it benefits from rigorous testing of more than 128,000 hours per day with real-world workloads and includes unique innovations such as Ksplice for zero-downtime kernel patching, DTrace for real-time diagnostics, the powerful Btrfs file system, and more. + +# Supported Docker versions + +This image is officially supported on Docker version 1.12.0. + +Support for older versions (down to 1.6) is provided on a best-effort basis. + +Please see [the Docker installation documentation](https://docs.docker.com/installation/) for details on how to upgrade your Docker daemon. + +# User Feedback + +## Documentation + +Documentation for this image is stored in the [`agent2/` directory](https://github.com/zabbix/zabbix-docker/tree/5.0/agent2) of the [`zabbix/zabbix-docker` GitHub repo](https://github.com/zabbix/zabbix-docker/). Be sure to familiarize yourself with the [repository's `README.md` file](https://github.com/zabbix/zabbix-docker/blob/master/README.md) before attempting a pull request. + +## Issues + +If you have any problems with or questions about this image, please contact us through a [GitHub issue](https://github.com/zabbix/zabbix-docker/issues). + +### Known issues + +Currently it is not allowed to specify ``ZBX_ALIAS`` environment variable. Please use ``/etc/zabbix/zabbix_agent.d`` volume with additional configuration files with ``Alias`` options. + +## Contributing + +You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can. + +Before you start to code, we recommend discussing your plans through a [GitHub issue](https://github.com/zabbix/zabbix-docker/issues), especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing. diff --git a/Dockerfiles/agent2/centos/build.sh b/Dockerfiles/agent2/centos/build.sh new file mode 120000 index 000000000..46b203134 --- /dev/null +++ b/Dockerfiles/agent2/centos/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/Dockerfiles/agent2/centos/docker-entrypoint.sh b/Dockerfiles/agent2/centos/docker-entrypoint.sh new file mode 100755 index 000000000..14229d7ab --- /dev/null +++ b/Dockerfiles/agent2/centos/docker-entrypoint.sh @@ -0,0 +1,217 @@ +#!/bin/bash + +set -o pipefail + +set +e + +# Script trace mode +if [ "${DEBUG_MODE,,}" == "true" ]; then + set -o xtrace +fi + +# Default Zabbix installation name +# Default Zabbix server host +: ${ZBX_SERVER_HOST:="zabbix-server"} +# Default Zabbix server port number +: ${ZBX_SERVER_PORT:="10051"} + +# Default directories +# User 'zabbix' home directory +ZABBIX_USER_HOME_DIR="/var/lib/zabbix" +# Configuration files directory +ZABBIX_ETC_DIR="/etc/zabbix" + +escape_spec_char() { + local var_value=$1 + + var_value="${var_value//\\/\\\\}" + var_value="${var_value//[$'\n']/}" + var_value="${var_value//\//\\/}" + var_value="${var_value//./\\.}" + var_value="${var_value//\*/\\*}" + var_value="${var_value//^/\\^}" + var_value="${var_value//\$/\\\$}" + var_value="${var_value//\&/\\\&}" + var_value="${var_value//\[/\\[}" + var_value="${var_value//\]/\\]}" + + echo "$var_value" +} + +update_config_var() { + local config_path=$1 + local var_name=$2 + local var_value=$3 + local is_multiple=$4 + + local masklist=("TLSPSKIdentity") + + if [ ! -f "$config_path" ]; then + echo "**** Configuration file '$config_path' does not exist" + return + fi + + if [[ " ${masklist[@]} " =~ " $var_name " ]] && [ ! -z "$var_value" ]; then + echo -n "** Updating '$config_path' parameter \"$var_name\": '****'. Enable DEBUG_MODE to view value ..." + else + echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." + fi + + # Remove configuration parameter definition in case of unset parameter value + if [ -z "$var_value" ]; then + sed -i -e "/^$var_name=/d" "$config_path" + echo "removed" + return + fi + + # Remove value from configuration parameter in case of double quoted parameter value + if [ "$var_value" == '""' ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + echo "undefined" + return + fi + + # Use full path to a file for TLS related configuration parameters + if [[ $var_name =~ ^TLS.*File$ ]]; then + var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value + fi + + # Escaping characters in parameter value and name + var_value=$(escape_spec_char "$var_value") + var_name=$(escape_spec_char "$var_name") + + if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then + sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path" + echo "updated" + elif [ "$(grep -Ec "^# $var_name=" $config_path)" -gt 1 ]; then + sed -i -e "/^[#;] $var_name=$/i\\$var_name=$var_value" "$config_path" + echo "added first occurrence" + elif [ "$(grep -Ec "^[#;] $var_name=" $config_path)" -gt 0 ]; then + sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=$var_value/" "$config_path" + echo "added" + else + sed -i -e '$a\' -e "$var_name=$var_value" "$config_path" + echo "added at the end" + fi + +} + +update_config_multiple_var() { + local config_path=$1 + local var_name=$2 + local var_value=$3 + + var_value="${var_value%\"}" + var_value="${var_value#\"}" + + local IFS=, + local OPT_LIST=($var_value) + + for value in "${OPT_LIST[@]}"; do + update_config_var $config_path $var_name $value true + done +} + +prepare_zbx_agent_config() { + echo "** Preparing Zabbix agent configuration file" + ZBX_AGENT_CONFIG=$ZABBIX_ETC_DIR/zabbix_agent2.conf + + : ${ZBX_PASSIVESERVERS:=""} + : ${ZBX_ACTIVESERVERS:=""} + + [ -n "$ZBX_PASSIVESERVERS" ] && ZBX_PASSIVESERVERS=","$ZBX_PASSIVESERVERS + + ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST$ZBX_PASSIVESERVERS + + [ -n "$ZBX_ACTIVESERVERS" ] && ZBX_ACTIVESERVERS=","$ZBX_ACTIVESERVERS + + ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST":"$ZBX_SERVER_PORT$ZBX_ACTIVESERVERS + + update_config_var $ZBX_AGENT_CONFIG "PidFile" + update_config_var $ZBX_AGENT_CONFIG "LogType" "console" + update_config_var $ZBX_AGENT_CONFIG "LogFile" + update_config_var $ZBX_AGENT_CONFIG "LogFileSize" + update_config_var $ZBX_AGENT_CONFIG "DebugLevel" "${ZBX_DEBUGLEVEL}" + update_config_var $ZBX_AGENT_CONFIG "SourceIP" + update_config_var $ZBX_AGENT_CONFIG "LogRemoteCommands" "${ZBX_LOGREMOTECOMMANDS}" + + : ${ZBX_PASSIVE_ALLOW:="true"} + if [ "${ZBX_PASSIVE_ALLOW,,}" == "true" ]; then + echo "** Using '$ZBX_PASSIVESERVERS' servers for passive checks" + update_config_var $ZBX_AGENT_CONFIG "Server" "${ZBX_PASSIVESERVERS}" + else + update_config_var $ZBX_AGENT_CONFIG "Server" + fi + + update_config_var $ZBX_AGENT_CONFIG "ListenPort" "${ZBX_LISTENPORT}" + update_config_var $ZBX_AGENT_CONFIG "ListenIP" "${ZBX_LISTENIP}" + + : ${ZBX_ACTIVE_ALLOW:="true"} + if [ "${ZBX_ACTIVE_ALLOW,,}" == "true" ]; then + echo "** Using '$ZBX_ACTIVESERVERS' servers for active checks" + update_config_var $ZBX_AGENT_CONFIG "ServerActive" "${ZBX_ACTIVESERVERS}" + else + update_config_var $ZBX_AGENT_CONFIG "ServerActive" + fi + + if [ "${ZBX_ENABLEPERSISTENTBUFFER,,}" == "true" ]; then + update_config_var $ZBX_AGENT_CONFIG "EnablePersistentBuffer" "1" + update_config_var $ZBX_AGENT_CONFIG "PersistentBufferFile" "$ZABBIX_USER_HOME_DIR/buffer/agent2.db" + update_config_var $ZBX_AGENT_CONFIG "PersistentBufferPeriod" "${ZBX_PERSISTENTBUFFERPERIOD}" + else + update_config_var $ZBX_AGENT_CONFIG "EnablePersistentBuffer" "0" + fi + + if [ "${ZBX_ENABLESTATUSPORT,,}" == "true" ]; then + update_config_var $ZBX_AGENT_CONFIG "StatusPort" "31999" + fi + +# update_config_var $ZBX_AGENT_CONFIG "HostInterface" "${ZBX_HOSTINTERFACE}" +# update_config_var $ZBX_AGENT_CONFIG "HostInterfaceItem" "${ZBX_HOSTINTERFACEITEM}" + + update_config_var $ZBX_AGENT_CONFIG "Hostname" "${ZBX_HOSTNAME}" + update_config_var $ZBX_AGENT_CONFIG "HostnameItem" "${ZBX_HOSTNAMEITEM}" + update_config_var $ZBX_AGENT_CONFIG "HostMetadata" "${ZBX_METADATA}" + update_config_var $ZBX_AGENT_CONFIG "HostMetadataItem" "${ZBX_METADATAITEM}" + update_config_var $ZBX_AGENT_CONFIG "RefreshActiveChecks" "${ZBX_REFRESHACTIVECHECKS}" + update_config_var $ZBX_AGENT_CONFIG "BufferSend" "${ZBX_BUFFERSEND}" + update_config_var $ZBX_AGENT_CONFIG "BufferSize" "${ZBX_BUFFERSIZE}" + update_config_var $ZBX_AGENT_CONFIG "MaxLinesPerSecond" "${ZBX_MAXLINESPERSECOND}" + # Please use include to enable Alias feature +# update_config_multiple_var $ZBX_AGENT_CONFIG "Alias" ${ZBX_ALIAS} + update_config_var $ZBX_AGENT_CONFIG "Timeout" "${ZBX_TIMEOUT}" + update_config_var $ZBX_AGENT_CONFIG "Include" "/etc/zabbix/zabbix_agentd.d/" + update_config_var $ZBX_AGENT_CONFIG "UnsafeUserParameters" "${ZBX_UNSAFEUSERPARAMETERS}" + update_config_var $ZBX_AGENT_CONFIG "TLSConnect" "${ZBX_TLSCONNECT}" + update_config_var $ZBX_AGENT_CONFIG "TLSAccept" "${ZBX_TLSACCEPT}" + update_config_var $ZBX_AGENT_CONFIG "TLSCAFile" "${ZBX_TLSCAFILE}" + update_config_var $ZBX_AGENT_CONFIG "TLSCRLFile" "${ZBX_TLSCRLFILE}" + update_config_var $ZBX_AGENT_CONFIG "TLSServerCertIssuer" "${ZBX_TLSSERVERCERTISSUER}" + update_config_var $ZBX_AGENT_CONFIG "TLSServerCertSubject" "${ZBX_TLSSERVERCERTSUBJECT}" + update_config_var $ZBX_AGENT_CONFIG "TLSCertFile" "${ZBX_TLSCERTFILE}" + update_config_var $ZBX_AGENT_CONFIG "TLSKeyFile" "${ZBX_TLSKEYFILE}" + update_config_var $ZBX_AGENT_CONFIG "TLSPSKIdentity" "${ZBX_TLSPSKIDENTITY}" + update_config_var $ZBX_AGENT_CONFIG "TLSPSKFile" "${ZBX_TLSPSKFILE}" + + update_config_multiple_var $ZBX_AGENT_CONFIG "DenyKey" "${ZBX_DENYKEY}" + update_config_multiple_var $ZBX_AGENT_CONFIG "AllowKey" "${ZBX_ALLOWKEY}" +} + +prepare_agent() { + echo "** Preparing Zabbix agent" + prepare_zbx_agent_config +} + +################################################# + +if [ "${1#-}" != "$1" ]; then + set -- /usr/sbin/zabbix_agent2 "$@" +fi + +if [ "$1" == '/usr/sbin/zabbix_agent2' ]; then + prepare_agent +fi + +exec "$@" + +################################################# diff --git a/Dockerfiles/agent2/centos/hooks/build b/Dockerfiles/agent2/centos/hooks/build new file mode 100755 index 000000000..3e0a2f00c --- /dev/null +++ b/Dockerfiles/agent2/centos/hooks/build @@ -0,0 +1,13 @@ +#!/bin/bash +# +# Additional information: https://docs.docker.com/docker-cloud/builds/advanced/ +# + +MAJOR_VERSION=$(cat Dockerfile | grep "ARG MAJOR_VERSION" | cut -f2 -d"=") +MINOR_VERSION=$(cat Dockerfile | grep "ARG ZBX_VERSION" | cut -f2 -d".") + +VCS_REF=$MAJOR_VERSION.$MINOR_VERSION +BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + +echo "$BUILD_DATE - Building $VCS_REF version..." +docker build --build-arg VCS_REF="$VCS_REF" --build-arg BUILD_DATE="$BUILD_DATE" -t $IMAGE_NAME . diff --git a/Dockerfiles/agent2/ol/Dockerfile b/Dockerfiles/agent2/ol/Dockerfile index c01872f3f..d1a425d11 100644 --- a/Dockerfiles/agent2/ol/Dockerfile +++ b/Dockerfiles/agent2/ol/Dockerfile @@ -1,14 +1,35 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix agent 2" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix agent 2 is deployed on a monitoring target to actively monitor local resources and applications" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2", "/usr/sbin/zabbix_agent2"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.conf", "/etc/zabbix/zabbix_agent2.conf"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -33,99 +54,18 @@ RUN set -eux && \ pcre \ libcurl \ openssl-libs" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ - microdnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && REPOLIST="ol8_baseos_latest,ol8_appstream" && \ - INSTALL_PKGS="autoconf \ - automake \ - pcre-devel \ - libcurl-devel \ - make \ - openssl-devel \ - openldap-devel \ - git \ - wget \ - tar \ - gcc" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - ARCH_SUFFIX="$(arch)"; \ - case "$ARCH_SUFFIX" in \ - x86_64) \ - url='https://dl.google.com/go/go1.17.1.linux-amd64.tar.gz'; \ - sha256='dab7d9c34361dc21ec237d584590d72500652e7c909bf082758fb63064fca0ef'; \ - ;; \ - aarch64) \ - url='https://dl.google.com/go/go1.17.1.linux-arm64.tar.gz'; \ - sha256='53b29236fa03ed862670a5e5e2ab2439a2dc288fe61544aa392062104ac0128c'; \ - ;; \ - *) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \ - esac; \ - wget -O go.tgz.asc "$url.asc" && \ - wget -O go.tgz "$url" --progress=dot:giga && \ - echo "$sha256 *go.tgz" | sha256sum -c - && \ - GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 'EB4C 1BFD 4F04 2F6D DDCC EC91 7721 F63B D38B 4796' && \ - gpg --batch --verify go.tgz.asc go.tgz && \ - gpgconf --kill all && \ - rm -rf "$GNUPGHOME" go.tgz.asc && \ - tar -C /usr/local -xzf go.tgz && \ - rm go.tgz && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/go/pkg/version/version.go && \ - ./bootstrap.sh && \ - export PATH=/usr/local/go/bin:$PATH && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - export GOPATH=/tmp/zabbix-${ZBX_VERSION}/go && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --prefix=/usr \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --with-openssl \ - --enable-ipv6 \ - --enable-agent2 \ - --enable-agent \ - --silent && \ - make -j"$(nproc)" -s && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 /usr/sbin/zabbix_agent2 && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.conf /etc/zabbix/zabbix_agent2.conf && \ - strip /usr/sbin/zabbix_agent2 && \ - strip /usr/bin/zabbix_get && \ - strip /usr/bin/zabbix_sender && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - rm -rf /usr/local/go && \ + microdnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/agent2/ol/README.md b/Dockerfiles/agent2/ol/README.md index 1e32848d1..ca33c13f5 100644 --- a/Dockerfiles/agent2/ol/README.md +++ b/Dockerfiles/agent2/ol/README.md @@ -188,11 +188,11 @@ This variant is highly recommended when final image size being as small as possi To minimize image size, it's uncommon for additional related tools (such as `git` or `bash`) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the [`alpine` image description](https://hub.docker.com/_/alpine/) for examples of how to install packages if you are unfamiliar). -## `zabbix-agent:ubuntu-` +## `zabbix-agent2:ubuntu-` This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of. -## `zabbix-agent:ol-` +## `zabbix-agent2:ol-` Oracle Linux is an open-source operating system available under the GNU General Public License (GPLv2). Suitable for general purpose or Oracle workloads, it benefits from rigorous testing of more than 128,000 hours per day with real-world workloads and includes unique innovations such as Ksplice for zero-downtime kernel patching, DTrace for real-time diagnostics, the powerful Btrfs file system, and more. diff --git a/Dockerfiles/agent2/rhel/Dockerfile b/Dockerfiles/agent2/rhel/Dockerfile index fb4bbace3..5293056ff 100644 --- a/Dockerfiles/agent2/rhel/Dockerfile +++ b/Dockerfiles/agent2/rhel/Dockerfile @@ -69,19 +69,43 @@ RUN set -eux && INSTALL_PKGS="bash \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki RUN set -eux && REPOLIST="ubi-8-baseos,ubi-8-appstream" && \ + PATH=/usr/local/go/bin:$PATH && \ INSTALL_PKGS="autoconf \ automake \ libcurl-devel \ openssl-devel \ openldap-devel \ - golang \ gcc \ pcre-devel \ make \ git \ + wget \ + tar \ binutils" && \ dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ + ARCH_SUFFIX="$(arch)"; \ + case "$ARCH_SUFFIX" in \ + x86_64) \ + url='https://dl.google.com/go/go1.17.1.linux-amd64.tar.gz'; \ + sha256='dab7d9c34361dc21ec237d584590d72500652e7c909bf082758fb63064fca0ef'; \ + ;; \ + aarch64) \ + url='https://dl.google.com/go/go1.17.1.linux-arm64.tar.gz'; \ + sha256='53b29236fa03ed862670a5e5e2ab2439a2dc288fe61544aa392062104ac0128c'; \ + ;; \ + *) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \ + esac; \ + wget -O go.tgz.asc "$url.asc" && \ + wget -O go.tgz "$url" --progress=dot:giga && \ + echo "$sha256 *go.tgz" | sha256sum -c - && \ + GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 'EB4C 1BFD 4F04 2F6D DDCC EC91 7721 F63B D38B 4796' && \ + gpg --batch --verify go.tgz.asc go.tgz && \ + gpgconf --kill all && \ + rm -rf "$GNUPGHOME" go.tgz.asc && \ + tar -C /usr/local -xzf go.tgz && \ + rm go.tgz && \ cd /tmp/ && \ git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ cd /tmp/zabbix-${ZBX_VERSION} && \ @@ -111,6 +135,7 @@ RUN set -eux && REPOLIST="ubi-8-baseos,ubi-8-appstream" && \ strip /usr/bin/zabbix_sender && \ cd /tmp/ && \ rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ + rm -rf /usr/local/go/ && \ dnf -y history undo last && \ dnf -y clean all && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ diff --git a/Dockerfiles/agent2/ubuntu/Dockerfile b/Dockerfiles/agent2/ubuntu/Dockerfile index ee221289f..4275060d9 100644 --- a/Dockerfiles/agent2/ubuntu/Dockerfile +++ b/Dockerfiles/agent2/ubuntu/Dockerfile @@ -1,25 +1,37 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ubuntu-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM ubuntu:focal +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix agent 2" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix agent 2 is deployed on a monitoring target to actively monitor local resources and applications" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2", "/usr/sbin/zabbix_agent2"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.conf", "/etc/zabbix/zabbix_agent2.conf"] + RUN set -eux && \ - ARCH_SUFFIX="$(arch)"; \ - case "$ARCH_SUFFIX" in \ - i686) export ARCH_SUFFIX='i386' ;; \ - x86_64) [ -f /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ] && export ARCH_SUFFIX='amd64' || export ARCH_SUFFIX='i386' ;; \ - aarch64) export ARCH_SUFFIX='arm64' ;; \ - armv7l) export ARCH_SUFFIX='armhf' ;; \ - ppc64el|ppc64le) export ARCH_SUFFIX='ppc64le' ;; \ - s390x) export ARCH_SUFFIX='s390x' ;; \ - *) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \ - esac; \ echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d && \ groupadd --system --gid 1995 zabbix && \ useradd \ @@ -43,73 +55,6 @@ RUN set -eux && \ libssl1.1 \ libcurl4 \ libldap-2.4 && \ - apt-get -y autoremove && \ - apt-get -y clean && \ - rm -rf /var/lib/apt/lists/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - apt-get -y update && \ - DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \ - autoconf \ - automake \ - libpcre3-dev \ - libssl-dev \ - zlib1g-dev \ - make \ - pkg-config \ - git \ - g++ \ - golang-1.16 && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - PATH=/usr/lib/go-1.16/bin:$PATH && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --prefix=/usr \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --with-openssl \ - --enable-ipv6 \ - --enable-agent2 \ - --enable-agent \ - --silent && \ - make -j"$(nproc)" -s && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 /usr/sbin/zabbix_agent2 && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.conf /etc/zabbix/zabbix_agent2.conf && \ - strip /usr/sbin/zabbix_agent2 && \ - strip /usr/bin/zabbix_get && \ - strip /usr/bin/zabbix_sender && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ - apt-get -y purge \ - autoconf \ - automake \ - libpcre3-dev \ - libssl-dev \ - zlib1g-dev \ - make \ - pkg-config \ - git \ - gcc \ - golang && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ diff --git a/Dockerfiles/agent2/ubuntu/README.md b/Dockerfiles/agent2/ubuntu/README.md index 1e32848d1..ca33c13f5 100644 --- a/Dockerfiles/agent2/ubuntu/README.md +++ b/Dockerfiles/agent2/ubuntu/README.md @@ -188,11 +188,11 @@ This variant is highly recommended when final image size being as small as possi To minimize image size, it's uncommon for additional related tools (such as `git` or `bash`) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the [`alpine` image description](https://hub.docker.com/_/alpine/) for examples of how to install packages if you are unfamiliar). -## `zabbix-agent:ubuntu-` +## `zabbix-agent2:ubuntu-` This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of. -## `zabbix-agent:ol-` +## `zabbix-agent2:ol-` Oracle Linux is an open-source operating system available under the GNU General Public License (GPLv2). Suitable for general purpose or Oracle workloads, it benefits from rigorous testing of more than 128,000 hours per day with real-world workloads and includes unique innovations such as Ksplice for zero-downtime kernel patching, DTrace for real-time diagnostics, the powerful Btrfs file system, and more. diff --git a/Dockerfiles/agent2/windows/Dockerfile b/Dockerfiles/agent2/windows/Dockerfile new file mode 100644 index 000000000..9e89df018 --- /dev/null +++ b/Dockerfiles/agent2/windows/Dockerfile @@ -0,0 +1,63 @@ +# syntax=docker/dockerfile:1 +# escape=` +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-agent:ltsc2022-agent2-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git +ARG BASE_IMAGE=mcr.microsoft.com/powershell:lts-nanoserver-ltsc2022 + +FROM ${BUILD_BASE_IMAGE} as builder + +FROM $BASE_IMAGE + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +LABEL org.opencontainers.image.title="Zabbix agent 2" ` + org.opencontainers.image.authors="Alexey Pustovalov " ` + org.opencontainers.image.vendor="Zabbix LLC" ` + org.opencontainers.image.url="https://zabbix.com/" ` + org.opencontainers.image.description="Zabbix agent 2 is deployed on a monitoring target to actively monitor local resources and applications" ` + org.opencontainers.image.licenses="GPL v2.0" ` + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" ` + org.opencontainers.image.version="${ZBX_VERSION}" ` + org.opencontainers.image.source="${ZBX_SOURCES}" + +SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop';"] + +WORKDIR C:\zabbix\ + +COPY --from=builder ["C:\\zabbix2", "C:\\zabbix"] +COPY [".\\docker-entrypoint.ps1", "C:\\zabbix"] + +USER ContainerAdministrator + +RUN $env:PATH = [string]::Format('{0}\zabbix\sbin;{0}\zabbix\bin;', $env:SystemDrive) + $env:PATH; ` + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); ` + ` + $env:ZBX_HOME = [string]::Format('{0}\zabbix', $env:SystemDrive); ` + [Environment]::SetEnvironmentVariable('ZBX_HOME', $env:ZBX_HOME, [EnvironmentVariableTarget]::Machine); + +RUN Set-Location -Path $env:SystemDrive\.; ` + ` + New-Item -ItemType directory -Path $env:ZBX_HOME\conf\zabbix_agentd.d | Out-Null; ` + New-Item -ItemType directory -Path $env:ZBX_HOME\enc | Out-Null; ` + New-Item -ItemType directory -Path $env:ZBX_HOME\modules | Out-Null; ` + New-Item -ItemType directory -Path $env:ZBX_HOME\buffer | Out-Null; ` + ` + net user /add zabbix; ` + $acl = Get-Acl -Path $env:ZBX_HOME; ` + $ace = New-Object Security.AccessControl.FileSystemAccessRule ('zabbix', 'Modify', 'ContainerInherit, ObjectInherit', 'InheritOnly', 'Allow'); ` + $acl.AddAccessRule($ace); ` + Set-Acl -AclObject $acl -Path $env:ZBX_HOME; + +USER zabbix + +EXPOSE 10050/TCP 31999/TCP + +CMD C:\zabbix\docker-entrypoint.ps1 C:\zabbix\sbin\zabbix_agent2.exe -c C:\zabbix\conf\zabbix_agent2.win.conf -f diff --git a/Dockerfiles/agent2/windows/docker-entrypoint.ps1 b/Dockerfiles/agent2/windows/docker-entrypoint.ps1 new file mode 100644 index 000000000..0e0474283 --- /dev/null +++ b/Dockerfiles/agent2/windows/docker-entrypoint.ps1 @@ -0,0 +1,239 @@ + +# Script trace mode +if ($env:DEBUG_MODE -eq "true") { + Set-PSDebug -trace 1 +} + +# Default Zabbix installation name +# Default Zabbix server host +if ([string]::IsNullOrWhitespace($env:ZBX_SERVER_HOST)) { + $env:ZBX_SERVER_HOST="zabbix-server" +} +# Default Zabbix server port number +if ([string]::IsNullOrWhitespace($env:ZBX_SERVER_PORT)) { + $env:ZBX_SERVER_PORT="10051" +} + + +# Default directories +# User 'zabbix' home directory +$ZabbixUserHomeDir="C:\zabbix" +# Configuration files directory +$ZabbixConfigDir="C:\zabbix\conf" + +function Update-Config-Var { + Param ( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] $ConfigPath, + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [string]$VarName, + [Parameter(Mandatory=$false, Position=2)] + [string]$VarValue = $null, + [Parameter(Mandatory=$false, Position=3)] + [bool]$IsMultiple + ) + + $MaskList = "TLSPSKIdentity" + + if (-not(Test-Path -Path $ConfigPath -PathType Leaf)) { + throw "**** Configuration file '$ConfigPath' does not exist" + } + + if ($MaskList.Contains($VarName) -eq $true -And [string]::IsNullOrWhitespace($VarValue) -ne $true) { + Write-Host -NoNewline "** Updating '$ConfigPath' parameter ""$VarName"": '****'. Enable DEBUG_MODE to view value ..." + } + else { + Write-Host -NoNewline "** Updating '$ConfigPath' parameter ""$VarName"": '$VarValue'..." + } + + if ([string]::IsNullOrWhitespace($VarValue)) { + if ((Get-Content $ConfigPath | %{$_ -match "^$VarName="}) -contains $true) { + (Get-Content $ConfigPath) | + Where-Object {$_ -notmatch "^$VarName=" } | + Set-Content $ConfigPath + } + + Write-Host "removed" + return + } + + if ($VarValue -eq '""') { + (Get-Content $ConfigPath) | Foreach-Object { $_ -Replace "^($VarName=)(.*)", '$1' } | Set-Content $ConfigPath + Write-Host "undefined" + return + } + + if ($VarName -match '^TLS.*File$') { + $VarValue="$ZabbixUserHomeDir\enc\$VarValue" + } + + if ((Get-Content $ConfigPath | %{$_ -match "^$VarName="}) -contains $true -And $IsMultiple -ne $true) { + (Get-Content $ConfigPath) | Foreach-Object { $_ -Replace "^$VarName=.+", "$VarName=$VarValue" } | Set-Content $ConfigPath + + Write-Host updated + } + elseif ((Get-Content $ConfigPath | select-string -pattern "^[#;] $VarName=").length -gt 0) { + (Get-Content $ConfigPath) | + Foreach-Object { + $_ + if ($_ -match "^[#;] $VarName=") { + "$VarName=$VarValue" + } + } | Set-Content $ConfigPath + + Write-Host "added" + } + else { + Add-Content -Path $ConfigPath -Value "$VarName=$VarValue" + Write-Host "added at the end" + } +} + +function Update-Config-Multiple-Var { + Param ( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] $ConfigPath, + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [string]$VarName, + [Parameter(Mandatory=$false, Position=2)] + [string]$VarValue = $null + ) + + foreach ($value in $VarValue.split(',')) { + Update-Config-Var $ConfigPath $VarName $value $true + } +} + +function Prepare-Zbx-Agent-Config { + Write-Host "** Preparing Zabbix agent configuration file" + + $ZbxAgentConfig="$ZabbixConfigDir\zabbix_agent2.win.conf" + + if ([string]::IsNullOrWhitespace($env:ZBX_PASSIVESERVERS)) { + $env:ZBX_PASSIVESERVERS="" + } + else { + $env:ZBX_PASSIVESERVERS=",$env:ZBX_PASSIVESERVERS" + } + + $env:ZBX_PASSIVESERVERS=$env:ZBX_SERVER_HOST + $env:ZBX_PASSIVESERVERS + + if ([string]::IsNullOrWhitespace($env:ZBX_ACTIVESERVERS)) { + $env:ZBX_ACTIVESERVERS="" + } + else { + $env:ZBX_ACTIVESERVERS=",$env:ZBX_ACTIVESERVERS" + } + + $env:ZBX_ACTIVESERVERS=$env:ZBX_SERVER_HOST + ":" + $env:ZBX_SERVER_PORT + $env:ZBX_ACTIVESERVERS + + Update-Config-Var $ZbxAgentConfig "LogType" "console" + Update-Config-Var $ZbxAgentConfig "LogFile" + Update-Config-Var $ZbxAgentConfig "LogFileSize" + Update-Config-Var $ZbxAgentConfig "DebugLevel" "$env:ZBX_DEBUGLEVEL" + Update-Config-Var $ZbxAgentConfig "SourceIP" + Update-Config-Var $ZbxAgentConfig "LogRemoteCommands" "$env:ZBX_LOGREMOTECOMMANDS" + + if ([string]::IsNullOrWhitespace($env:ZBX_PASSIVE_ALLOW)) { + $env:ZBX_PASSIVE_ALLOW="true" + } + + if ($env:ZBX_PASSIVE_ALLOW -eq "true") { + Write-Host "** Using '$env:ZBX_PASSIVESERVERS' servers for passive checks" + Update-Config-Var $ZbxAgentConfig "Server" "$env:ZBX_PASSIVESERVERS" + } + else { + Update-Config-Var $ZbxAgentConfig "Server" + } + + Update-Config-Var $ZbxAgentConfig "ListenPort" "$env:ZBX_LISTENPORT" + Update-Config-Var $ZbxAgentConfig "ListenIP" "$env:ZBX_LISTENIP" + + if ([string]::IsNullOrWhitespace($env:ZBX_ACTIVE_ALLOW)) { + $env:ZBX_ACTIVE_ALLOW="true" + } + + if ($env:ZBX_PASSIVE_ALLOW -eq "true") { + Write-Host "** Using '$env:ZBX_ACTIVESERVERS' servers for active checks" + Update-Config-Var $ZbxAgentConfig "ServerActive" "$env:ZBX_ACTIVESERVERS" + } + else { + Update-Config-Var $ZbxAgentConfig "ServerActive" + } + + if ([string]::IsNullOrWhitespace($env:ZBX_ENABLEPERSISTENTBUFFER)) { + $env:ZBX_ENABLEPERSISTENTBUFFER="true" + } + + if ($env:ZBX_ENABLEPERSISTENTBUFFER -eq "true") { + Update-Config-Var $ZbxAgentConfig "EnablePersistentBuffer" "1" + Update-Config-Var $ZbxAgentConfig "PersistentBufferFile" "$ZabbixUserHomeDir\buffer\agent2.db" + Update-Config-Var $ZbxAgentConfig "PersistentBufferPeriod" "$env:ZBX_PERSISTENTBUFFERPERIOD" + } + else { + Update-Config-Var $ZbxAgentConfig "EnablePersistentBuffer" "0" + } + + if ([string]::IsNullOrWhitespace($env:ZBX_ENABLESTATUSPORT)) { + $env:ZBX_ENABLESTATUSPORT="true" + } + + if ($env:ZBX_ENABLESTATUSPORT -eq "true") { + Update-Config-Var $ZbxAgentConfig "StatusPort" "31999" + } + + Update-Config-Var $ZbxAgentConfig "Hostname" "$env:ZBX_HOSTNAME" + Update-Config-Var $ZbxAgentConfig "HostnameItem" "$env:ZBX_HOSTNAMEITEM" + Update-Config-Var $ZbxAgentConfig "HostMetadata" "$env:ZBX_METADATA" + Update-Config-Var $ZbxAgentConfig "HostMetadataItem" "$env:ZBX_METADATAITEM" + Update-Config-Var $ZbxAgentConfig "HostInterface" "$env:ZBX_HOSTINTERFACE" + Update-Config-Var $ZbxAgentConfig "HostInterfaceItem" "$env:ZBX_HOSTINTERFACEITEM" + Update-Config-Var $ZbxAgentConfig "RefreshActiveChecks" "$env:ZBX_REFRESHACTIVECHECKS" + Update-Config-Var $ZbxAgentConfig "BufferSend" "$env:ZBX_BUFFERSEND" + Update-Config-Var $ZbxAgentConfig "BufferSize" "$env:ZBX_BUFFERSIZE" + Update-Config-Var $ZbxAgentConfig "MaxLinesPerSecond" "$env:ZBX_MAXLINESPERSECOND" + # Please use include to enable Alias feature +# update_config_multiple_var $ZBX_AGENT_CONFIG "Alias" $env:ZBX_ALIAS + # Please use include to enable Perfcounter feature +# update_config_multiple_var $ZBX_AGENT_CONFIG "PerfCounter" $env:ZBX_PERFCOUNTER + Update-Config-Var $ZbxAgentConfig "Timeout" "$env:ZBX_TIMEOUT" + Update-Config-Var $ZbxAgentConfig "Include" "$ZabbixConfigDir\zabbix_agentd.d\" + Update-Config-Var $ZbxAgentConfig "UnsafeUserParameters" "$env:ZBX_UNSAFEUSERPARAMETERS" + Update-Config-Var $ZbxAgentConfig "TLSConnect" "$env:ZBX_TLSCONNECT" + Update-Config-Var $ZbxAgentConfig "TLSAccept" "$env:ZBX_TLSACCEPT" + Update-Config-Var $ZbxAgentConfig "TLSCAFile" "$env:ZBX_TLSCAFILE" + Update-Config-Var $ZbxAgentConfig "TLSCRLFile" "$env:ZBX_TLSCRLFILE" + Update-Config-Var $ZbxAgentConfig "TLSServerCertIssuer" "$env:ZBX_TLSSERVERCERTISSUER" + Update-Config-Var $ZbxAgentConfig "TLSServerCertSubject" "$env:ZBX_TLSSERVERCERTSUBJECT" + Update-Config-Var $ZbxAgentConfig "TLSCertFile" "$env:ZBX_TLSCERTFILE" + Update-Config-Var $ZbxAgentConfig "TLSKeyFile" "$env:ZBX_TLSKEYFILE" + Update-Config-Var $ZbxAgentConfig "TLSPSKIdentity" "$env:ZBX_TLSPSKIDENTITY" + Update-Config-Var $ZbxAgentConfig "TLSPSKFile" "$env:ZBX_TLSPSKFILE" + + Update-Config-Multiple-Var $ZbxAgentConfig "DenyKey" "$env:ZBX_DENYKEY" + Update-Config-Multiple-Var $ZbxAgentConfig "AllowKey" "$env:ZBX_ALLOWKEY" + +} + +function PrepareAgent { + Write-Host "** Preparing Zabbix agent" + Prepare-Zbx-Agent-Config +} + +$commandArgs=$args + +if ($args.length -gt 0 -And $args[0].Substring(0, 1) -eq '-') { + $commandArgs = "C:\zabbix\sbin\zabbix_agent2.exe " + $commandArgs +} + +if ($args.length -gt 0 -And $args[0] -eq "C:\zabbix\sbin\zabbix_agent2.exe") { + PrepareAgent +} + +if ($args.length -gt 0) { + Invoke-Expression "$CommandArgs" +} diff --git a/Dockerfiles/build-base/alpine/.dockerignore b/Dockerfiles/build-base/alpine/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/Dockerfiles/build-base/alpine/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/Dockerfiles/build-base/alpine/Dockerfile b/Dockerfiles/build-base/alpine/Dockerfile new file mode 100644 index 000000000..289066ad1 --- /dev/null +++ b/Dockerfiles/build-base/alpine/Dockerfile @@ -0,0 +1,74 @@ +# syntax=docker/dockerfile:1 +FROM alpine:3.12 + +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + PATH=/usr/lib/jvm/default-jvm/bin:/usr/local/go/bin:$PATH \ + JAVA_HOME=/usr/lib/jvm/default-jvm + +LABEL org.opencontainers.image.title="Zabbix build base" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base image contains all required packages to build Zabbix images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +RUN set -eux && \ + apk add --no-cache --clean-protected \ + bash \ + autoconf \ + automake \ + coreutils \ + curl-dev \ + libevent-dev \ + libssh-dev \ + sqlite-dev \ + libxml2-dev \ + mysql-dev \ + net-snmp-dev \ + openipmi-dev \ + openldap-dev \ + pcre-dev \ + postgresql-dev \ + openjdk8 \ + gettext \ + git \ + g++ \ + go \ + make \ + openjdk8-jre-base \ + unixodbc-dev && \ + rm -rf /var/cache/apk/* + +ARG GOLANG_VERSION=1.17.2 +ENV PATH=/usr/local/go/bin:$PATH + +RUN set -eux && \ + apk add --no-cache musl-dev \ + openssl-dev \ + gnupg \ + ca-certificates && \ + update-ca-certificates && \ + url='https://dl.google.com/go/go1.17.2.src.tar.gz' && \ + sha256='2255eb3e4e824dd7d5fcdc2e7f84534371c186312e546fb1086a34c17752f431' && \ + wget -O go.tgz.asc "$url.asc" && \ + wget -O go.tgz "$url" && \ + echo "$sha256 *go.tgz" | sha256sum -c - && \ + GNUPGHOME="$(mktemp -d)"; export GNUPGHOME && \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 'EB4C 1BFD 4F04 2F6D DDCC EC91 7721 F63B D38B 4796' && \ + gpg --batch --verify go.tgz.asc go.tgz && \ + gpgconf --kill all && \ + rm -rf "$GNUPGHOME" go.tgz.asc && \ + tar -C /usr/local -xzf go.tgz && \ + rm go.tgz && \ + cd /usr/local/go/src && \ + export GOROOT_BOOTSTRAP="$(go env GOROOT)" && \ + ./make.bash && \ + apk del go && \ + rm -rf /var/cache/apk/* diff --git a/Dockerfiles/build-base/alpine/build.sh b/Dockerfiles/build-base/alpine/build.sh new file mode 120000 index 000000000..46b203134 --- /dev/null +++ b/Dockerfiles/build-base/alpine/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/Dockerfiles/build-base/centos/.dockerignore b/Dockerfiles/build-base/centos/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/Dockerfiles/build-base/centos/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/Dockerfiles/build-base/centos/Dockerfile b/Dockerfiles/build-base/centos/Dockerfile new file mode 100644 index 000000000..c8d4243be --- /dev/null +++ b/Dockerfiles/build-base/centos/Dockerfile @@ -0,0 +1,77 @@ +# syntax=docker/dockerfile:1 +FROM centos:8 + +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + PATH=/usr/local/go/bin:$PATH + +LABEL org.opencontainers.image.title="Zabbix build base" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base image contains all required packages to build Zabbix images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +RUN set -eux && \ + sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/CentOS-Linux-PowerTools.repo && \ + dnf --quiet makecache && \ + dnf -y install epel-release && \ + dnf -y module enable mysql && \ + INSTALL_PKGS="autoconf \ + automake \ + bash \ + gcc \ + pcre-devel \ + libcurl-devel \ + libevent-devel \ + libssh-devel \ + libxml2-devel \ + openssl-devel \ + openldap-devel \ + make \ + mysql-devel \ + net-snmp-devel \ + OpenIPMI-devel \ + openldap-devel \ + sqlite-devel \ + postgresql-devel \ + java-1.8.0-openjdk-devel \ + git \ + wget \ + tar \ + gettext \ + unixODBC-devel" && \ + dnf -y install --setopt=tsflags=nodocs --setopt=install_weak_deps=False --best \ + ${INSTALL_PKGS} && \ + ARCH_SUFFIX="$(arch)"; \ + case "$ARCH_SUFFIX" in \ + x86_64) \ + url='https://dl.google.com/go/go1.17.1.linux-amd64.tar.gz'; \ + sha256='dab7d9c34361dc21ec237d584590d72500652e7c909bf082758fb63064fca0ef'; \ + ;; \ + aarch64) \ + url='https://dl.google.com/go/go1.17.1.linux-arm64.tar.gz'; \ + sha256='53b29236fa03ed862670a5e5e2ab2439a2dc288fe61544aa392062104ac0128c'; \ + ;; \ + ppc64le) \ + url='https://golang.org/dl/go1.17.1.linux-ppc64le.tar.gz'; \ + sha256='df4fa945512c3b472cf3d2dcb2e4ae5b34819607bc63f3223f5bc0c17b637dd0'; \ + ;; \ + *) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \ + esac; \ + wget -O go.tgz.asc "$url.asc" && \ + wget -O go.tgz "$url" --progress=dot:giga && \ + echo "$sha256 *go.tgz" | sha256sum -c - && \ + GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 'EB4C 1BFD 4F04 2F6D DDCC EC91 7721 F63B D38B 4796' && \ + gpg --batch --verify go.tgz.asc go.tgz && \ + gpgconf --kill all && \ + rm -rf "$GNUPGHOME" go.tgz.asc && \ + tar -C /usr/local -xzf go.tgz && \ + rm go.tgz diff --git a/Dockerfiles/build-base/centos/build.sh b/Dockerfiles/build-base/centos/build.sh new file mode 120000 index 000000000..46b203134 --- /dev/null +++ b/Dockerfiles/build-base/centos/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/Dockerfiles/build-base/ol/.dockerignore b/Dockerfiles/build-base/ol/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/Dockerfiles/build-base/ol/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/Dockerfiles/build-base/ol/Dockerfile b/Dockerfiles/build-base/ol/Dockerfile new file mode 100644 index 000000000..15b87a198 --- /dev/null +++ b/Dockerfiles/build-base/ol/Dockerfile @@ -0,0 +1,76 @@ +# syntax=docker/dockerfile:1 +FROM oraclelinux:8-slim + +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + PATH=/usr/local/go/bin:$PATH + +LABEL org.opencontainers.image.title="Zabbix build base" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base image contains all required packages to build Zabbix images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +RUN set -eux && \ + microdnf -y module enable mysql && \ + INSTALL_PKGS="autoconf \ + automake \ + bash \ + gcc \ + pcre-devel \ + libcurl-devel \ + libevent-devel \ + libssh-devel \ + libxml2-devel \ + openssl-devel \ + openldap-devel \ + make \ + mysql-devel \ + net-snmp-devel \ + OpenIPMI-devel \ + openldap-devel \ + sqlite-devel \ + postgresql-devel \ + java-1.8.0-openjdk-devel \ + git \ + wget \ + tar \ + gettext \ + unixODBC-devel" && \ + microdnf -y install \ + --disablerepo "*" \ + --enablerepo "ol8_baseos_latest" \ + --enablerepo "ol8_appstream" \ + --enablerepo "ol8_codeready_builder" \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ + ARCH_SUFFIX="$(arch)"; \ + case "$ARCH_SUFFIX" in \ + x86_64) \ + url='https://dl.google.com/go/go1.17.1.linux-amd64.tar.gz'; \ + sha256='dab7d9c34361dc21ec237d584590d72500652e7c909bf082758fb63064fca0ef'; \ + ;; \ + aarch64) \ + url='https://dl.google.com/go/go1.17.1.linux-arm64.tar.gz'; \ + sha256='53b29236fa03ed862670a5e5e2ab2439a2dc288fe61544aa392062104ac0128c'; \ + ;; \ + *) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \ + esac; \ + wget -O go.tgz.asc "$url.asc" && \ + wget -O go.tgz "$url" --progress=dot:giga && \ + echo "$sha256 *go.tgz" | sha256sum -c - && \ + GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 'EB4C 1BFD 4F04 2F6D DDCC EC91 7721 F63B D38B 4796' && \ + gpg --batch --verify go.tgz.asc go.tgz && \ + gpgconf --kill all && \ + rm -rf "$GNUPGHOME" go.tgz.asc && \ + tar -C /usr/local -xzf go.tgz && \ + rm go.tgz diff --git a/Dockerfiles/build-base/ol/build.sh b/Dockerfiles/build-base/ol/build.sh new file mode 120000 index 000000000..46b203134 --- /dev/null +++ b/Dockerfiles/build-base/ol/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/Dockerfiles/build-base/ol/conf/etc/yum.repos.d/oracle-epel-ol8.repo b/Dockerfiles/build-base/ol/conf/etc/yum.repos.d/oracle-epel-ol8.repo new file mode 100644 index 000000000..6c99308a6 --- /dev/null +++ b/Dockerfiles/build-base/ol/conf/etc/yum.repos.d/oracle-epel-ol8.repo @@ -0,0 +1,6 @@ +[ol8_developer_EPEL] +name=Oracle Linux $releasever EPEL Packages for Development ($basearch) +baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL8/developer/EPEL/$basearch/ +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle +gpgcheck=1 +enabled=0 diff --git a/Dockerfiles/build-base/ubuntu/.dockerignore b/Dockerfiles/build-base/ubuntu/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/Dockerfiles/build-base/ubuntu/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/Dockerfiles/build-base/ubuntu/Dockerfile b/Dockerfiles/build-base/ubuntu/Dockerfile new file mode 100644 index 000000000..181e7ddd4 --- /dev/null +++ b/Dockerfiles/build-base/ubuntu/Dockerfile @@ -0,0 +1,47 @@ +# syntax=docker/dockerfile:1 +FROM ubuntu:focal + +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + PATH=/usr/lib/go-1.16/bin:$PATH + +LABEL org.opencontainers.image.title="Zabbix build base" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base image contains all required packages to build Zabbix images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +RUN set -eux && \ + apt-get -y update && \ + DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \ + bash \ + autoconf \ + automake \ + binutils \ + gcc \ + libc6-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libldap2-dev \ + libmysqlclient-dev \ + libopenipmi-dev \ + libpcre3-dev \ + libsnmp-dev \ + libsqlite3-dev \ + libpq-dev \ + libssh-dev \ + libxml2-dev \ + make \ + openjdk-8-jdk-headless \ + pkg-config \ + gettext \ + git \ + golang-1.16 \ + unixodbc-dev diff --git a/Dockerfiles/build-base/ubuntu/build.sh b/Dockerfiles/build-base/ubuntu/build.sh new file mode 120000 index 000000000..46b203134 --- /dev/null +++ b/Dockerfiles/build-base/ubuntu/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent b/Dockerfiles/build-base/windows/Dockerfile.agent new file mode 100644 index 000000000..fc0d87231 --- /dev/null +++ b/Dockerfiles/build-base/windows/Dockerfile.agent @@ -0,0 +1,214 @@ +# syntax=docker/dockerfile:1 +# escape=` +ARG BUILD_BASE_IMAGE=mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2022 +FROM $BUILD_BASE_IMAGE + +ARG PCRE_VERSION=8.45 +ARG OPENSSL_VERSION=1.1.1l +ARG BUILD_ARCH=x64 +ARG CPU_MODEL=AMD64 + +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +ARG VS_BUILDTOOLS_URL=https://aka.ms/vs/16/release/vs_buildtools.exe +ARG NASM_URL=https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/nasm-2.15.05-installer-x64.exe +ARG PERL_URL=https://strawberryperl.com/download/5.32.1.1/strawberry-perl-5.32.1.1-64bit.msi +ARG GIT_URL=https://github.com/git-for-windows/git/releases/download/v2.33.0.windows.2/MinGit-2.33.0.2-busybox-64-bit.zip +ARG PCRE_URL=https://ftp.pcre.org/pub/pcre/pcre-$PCRE_VERSION.zip +ARG OPENSSL_URL=https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz + +ENV BUILD_ARCH=$BUILD_ARCH CPU_MODEL=$CPU_MODEL ` + PCRE_VERSION=$PCRE_VERSION OPENSSL_VERSION=$OPENSSL_VERSION ` + GIT_URL=$GIT_URL NASM_URL=$NASM_URL PERL_URL=$PERL_URL PCRE_URL=$PCRE_URL OPENSSL_URL=$OPENSSL_URL + +LABEL org.opencontainers.image.title="Zabbix agent build base for Windows" ` + org.opencontainers.image.authors="Alexey Pustovalov " ` + org.opencontainers.image.vendor="Zabbix LLC" ` + org.opencontainers.image.url="https://zabbix.com/" ` + org.opencontainers.image.description="Zabbix build base image contains all required packages to build Zabbix agent images" ` + org.opencontainers.image.licenses="GPL v2.0" ` + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" ` + org.opencontainers.image.version="${ZBX_VERSION}" ` + org.opencontainers.image.source="${ZBX_SOURCES}" + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +RUN Set-Location -Path $env:SystemDrive\.; ` + ` + Write-Host ('Downloading {0} ...' -f $env:GIT_URL); ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + Invoke-WebRequest -OutFile $env:SystemDrive\git.zip -Uri $env:GIT_URL; ` + ` + $sha256 = '273f55e881094d00877d64f56570b0c997c4da5dedcb26738d56481033c1eba1'; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ((Get-FileHash $env:SystemDrive\git.zip -Algorithm sha256).Hash -ne $sha256) { ` + Write-Host 'Checksum GIT for Windows failed!'; ` + exit 1; ` + }; ` + ` + Write-Host 'Installing ...'; ` + Expand-Archive ` + -Path git.zip ` + -DestinationPath $env:SystemDrive\git\.; ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Path $env:SystemDrive\git.zip; ` + $env:PATH = [string]::Format('{0}\git\cmd;{0}\git\mingw64\bin;{0}\git\usr\bin;', $env:SystemDrive) + $env:PATH; ` + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); ` + ` + Write-Host 'Verifying install ("git version") ...'; ` + git version; ` + ` + Write-Host ('Downloading {0} ...' -f $env:NASM_URL); ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + Invoke-WebRequest -OutFile $env:SystemDrive\nasm_installer.exe -Uri $env:NASM_URL; ` + $sha256 = 'a02325b9fe54f917f5d6a3036637b38dbb6addf6f7ba9d344d9b943a143fe7d0'; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ((Get-FileHash $env:SystemDrive\nasm_installer.exe -Algorithm sha256).Hash -ne $sha256) { ` + Write-Host 'Checksum NASM failed!'; ` + exit 1; ` + }; ` + Write-Host 'Installing ...'; ` + Start-Process ` + -FilePath $env:SystemDrive\nasm_installer.exe ` + -ArgumentList '/S' -Wait; ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Path $env:SystemDrive\nasm_installer.exe; ` + ` + $env:PATH = [string]::Format('{0}\NASM;', ${env:ProgramFiles}) + $env:PATH; ` + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); ` + ` + Write-Host 'Verifying install ("nasm -v") ...'; ` + nasm -v; ` + ` + Write-Host ('Downloading {0} ...' -f $env:PERL_URL); ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + Invoke-WebRequest -OutFile $env:SystemDrive\perl_installer.msi -Uri $env:PERL_URL; ` + ` + $sha256 = '241a881670164feb0b91bb69d39fbbf84c981bec0d9f8c19959f8f48fd177768'; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ((Get-FileHash $env:SystemDrive\perl_installer.msi -Algorithm sha256).Hash -ne $sha256) { ` + Write-Host 'Checksum Strawberry Perl failed!'; ` + exit 1; ` + }; ` + Write-Host 'Installing ...'; ` + Start-Process ` + -FilePath 'msiexec.exe' ` + -ArgumentList """/i $env:SystemDrive\perl_installer.msi /qn /norestart INSTALLDIR=$env:SystemDrive\Strawberry""" ` + -Wait; ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Path $env:SystemDrive\perl_installer.msi; ` + $env:PATH = [string]::Format('{0}\Strawberry\perl\bin;', $env:SystemDrive) + $env:PATH; ` + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); ` + ` + Write-Host 'Verifying install ("perl -V") ...'; ` + perl -V; ` + ` + Write-Host 'Installing Text::Template...'; ` + cpan Text::Template; ` + ` + Write-Host ('Downloading {0} ...' -f $env:VS_BUILDTOOLS_URL); ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + Invoke-WebRequest -OutFile $env:SystemDrive\vs_buildtools.exe $env:VS_BUILDTOOLS_URL; ` + ` + Write-Host ('{0} - Visual Studio components installing...' -f $(Get-Date -format 'u')); ` + cmd /C start /w $env:SystemDrive\vs_buildtools.exe ` + --quiet ` + --wait ` + --norestart ` + --nocache modify ` + --installPath """${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\BuildTools""" ` + # https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2019 + --add Microsoft.VisualStudio.Component.Windows10SDK.19041 ` + --add Microsoft.VisualStudio.Component.VC.CMake.Project; ` + if ($err = dir $Env:TEMP -Filter dd_setup_*_errors.log | where Length -gt 0 | Get-Content) { ` + throw $err; ` + }; ` + Wait-Process -name msiexec; ` + Write-Host ('{0} - Visual Studio components installed' -f $(Get-Date -format 'u')); ` + ` + Write-Host 'Visual Studio components installation cleanup'; ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Path $env:SystemDrive\vs_buildtools.exe; ` + Get-ChildItem -Path """${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer""" -Directory -Recurse | Remove-Item -Force –Recurse; ` + Remove-Item -Force -Recurse $env:TEMP\*; ` + Write-Host 'Build environment is ready...'; + +RUN Set-Location -Path $env:SystemDrive\.; ` + ` + Import-Module ('{0}\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll' -f ${env:ProgramFiles(x86)} ); ` + Enter-VsDevShell -VsInstallPath ('{0}\Microsoft Visual Studio\2019\BuildTools' -f ${env:ProgramFiles(x86)}) -DevCmdArguments """-arch=$env:BUILD_ARCH"""; ` + ` + Write-Host ('Downloading {0} ...' -f $env:PCRE_URL); ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + Invoke-WebRequest -OutFile $env:SystemDrive\pcre.zip -Uri $env:PCRE_URL; ` + ` + $sha256 = '5b709aa45ea3b8bb73052947200ad187f651a2049158fb5bbfed329e4322a977'; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ((Get-FileHash $env:SystemDrive\pcre.zip -Algorithm sha256).Hash -ne $sha256) { ` + Write-Host 'Checksum PCRE library failed!'; ` + exit 1; ` + }; ` + Write-Host 'Extracting archive ...'; ` + Expand-Archive -Path $env:SystemDrive\pcre.zip -DestinationPath $env:SystemDrive; ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Path $env:SystemDrive\pcre.zip; ` + Rename-Item -Path $env:SystemDrive\pcre-$env:PCRE_VERSION -NewName $env:SystemDrive\pcre_build; ` + New-Item -ItemType directory -Path "$env:SystemDrive\pcre_build\build" | Out-Null; ` + ` + Set-Location -Path $env:SystemDrive\pcre_build\build; ` + Write-Host 'Building PCRE library ...'; ` + cmake --log-level=ERROR ` + -G 'Visual Studio 16 2019' ` + -A $env:BUILD_ARCH ` + -DPCRE_SUPPORT_UNICODE_PROPERTIES=ON ` + -DPCRE_SUPPORT_UTF=ON ` + -DCMAKE_C_FLAGS_RELEASE:string="""/MT""" ..; ` + msbuild PCRE.sln ` + -maxcpucount:"""$env:NUMBER_OF_PROCESSORS""" ` + /verbosity:quiet ` + /property:Configuration=Release ` + /property:Platform=$env:BUILD_ARCH ` + /target:pcre; ` + ` + Write-Host 'PCRE is ready...'; + +RUN Set-Location -Path $env:SystemDrive\.; ` + ` + Import-Module ('{0}\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll' -f ${env:ProgramFiles(x86)} ); ` + Enter-VsDevShell -VsInstallPath ('{0}\Microsoft Visual Studio\2019\BuildTools' -f ${env:ProgramFiles(x86)}) -DevCmdArguments """-arch=$env:BUILD_ARCH"""; ` + ` + Write-Host ('Downloading {0} ...' -f $env:OPENSSL_URL); ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + Invoke-WebRequest -OutFile $env:SystemDrive\openssl.tar.gz -Uri $env:OPENSSL_URL; ` + ` + $sha256 = '0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1'; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ((Get-FileHash $env:SystemDrive\openssl.tar.gz -Algorithm sha256).Hash -ne $sha256) { ` + Write-Host 'Checksum OpenSSL library failed!'; ` + exit 1; ` + }; ` + ` + Write-Host 'Extracting archive ...'; ` + tar -zxf $env:SystemDrive\openssl.tar.gz; ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Path $env:SystemDrive\openssl.tar.gz; ` + Rename-Item -Path $env:SystemDrive\openssl-$env:OPENSSL_VERSION -NewName $env:SystemDrive\openssl_build; ` + ` + Write-Host 'Building OpenSSL library...'; ` + Set-Location -Path $env:SystemDrive\openssl_build; ` + perl $env:SystemDrive\openssl_build\Configure ` + VC-WIN64A ` + no-shared ` + no-ui-console ` + no-tests ` +# enable-capieng ` + no-capieng ` + --api=1.1.0 ` + --prefix=$env:SystemDrive\openssl_output ` + --openssldir=$env:SystemDrive\openssl_output_ssl; ` + set CL=/MP; ` + nmake /S; ` + nmake /S install_sw; ` + Write-Host 'OpenSSL is ready...'; diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 new file mode 100644 index 000000000..4d8ac95d6 --- /dev/null +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -0,0 +1,251 @@ +# syntax=docker/dockerfile:1 +# escape=` +ARG BUILD_BASE_IMAGE=mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2022 +FROM $BUILD_BASE_IMAGE as builder_base + +ARG PCRE_VERSION=8.45 +ARG OPENSSL_VERSION=1.1.1l +ARG ZLIB_VERSION=1.2.11 +ARG GOLANG_VERSION=1.17.1 +ARG SEVEN_ZIP_VERSION=1900 +ARG BUILD_ARCH=x64 +ARG CPU_MODEL=AMD64 + +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +ARG VS_BUILDTOOLS_URL=https://aka.ms/vs/16/release/vs_buildtools.exe +ARG GIT_URL=https://github.com/git-for-windows/git/releases/download/v2.33.0.windows.2/MinGit-2.33.0.2-busybox-64-bit.zip +ARG MINGW_URL=https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-win32/sjlj/x86_64-8.1.0-release-win32-sjlj-rt_v6-rev0.7z +ARG GOLANG_URL=https://golang.org/dl/go$GOLANG_VERSION.windows-amd64.msi +ARG CYGWIN_URL=https://cygwin.com/setup-x86_64.exe +ARG PCRE_URL=https://ftp.pcre.org/pub/pcre/pcre-$PCRE_VERSION.zip +ARG OPENSSL_URL=https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz +ARG SEVEN_ZIP_URL=https://www.7-zip.org/a/7z$SEVEN_ZIP_VERSION-$BUILD_ARCH.msi + +ENV BUILD_ARCH=$BUILD_ARCH CPU_MODEL=$CPU_MODEL ` + PCRE_VERSION=$PCRE_VERSION OPENSSL_VERSION=$OPENSSL_VERSION ZLIB_VERSION=$ZLIB_VERSION ` + GOLANG_VERSION=$GOLANG_VERSION SEVEN_ZIP_VERSION=$SEVEN_ZIP_VERSION ` + GIT_URL=$GIT_URL MINGW_URL=$MINGW_URL CYGWIN_URL=$CYGWIN_URL GOLANG_URL=$GOLANG_URL SEVEN_ZIP_URL=$SEVEN_ZIP_URL ` + PCRE_URL=$PCRE_URL OPENSSL_URL=$OPENSSL_URL + +LABEL org.opencontainers.image.title="Zabbix agent 2 build base for Windows" ` + org.opencontainers.image.authors="Alexey Pustovalov " ` + org.opencontainers.image.vendor="Zabbix LLC" ` + org.opencontainers.image.url="https://zabbix.com/" ` + org.opencontainers.image.description="Zabbix build base image contains all required packages to build Zabbix agent 2 images" ` + org.opencontainers.image.licenses="GPL v2.0" ` + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" ` + org.opencontainers.image.version="${ZBX_VERSION}" ` + org.opencontainers.image.source="${ZBX_SOURCES}" + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +RUN Set-Location -Path $env:SystemDrive\.; ` + ` + Write-Host ('Downloading {0} ...' -f $env:GIT_URL); ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + Invoke-WebRequest -OutFile $env:SystemDrive\git.zip -Uri $env:GIT_URL; ` + ` + $sha256 = '273f55e881094d00877d64f56570b0c997c4da5dedcb26738d56481033c1eba1'; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ((Get-FileHash $env:SystemDrive\git.zip -Algorithm sha256).Hash -ne $sha256) { ` + Write-Host 'Checksum GIT for Windows failed!'; ` + exit 1; ` + }; ` + ` + Write-Host 'Installing ...'; ` + Expand-Archive -Path git.zip -DestinationPath $env:SystemDrive\git\.; ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Path $env:SystemDrive\git.zip; ` + $env:PATH = [string]::Format('{0}\git\cmd;{0}\git\mingw64\bin;{0}\git\usr\bin;', $env:SystemDrive) + $env:PATH; ` + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); ` + ` + Write-Host 'Verifying install ("git version") ...'; ` + git version; ` + ` + Write-Host ('Downloading {0} ...' -f $env:GOLANG_URL); ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + Invoke-WebRequest -OutFile $env:SystemDrive\go-amd64.msi -Uri $env:GOLANG_URL; ` + $sha256 = '7a360967708350354ea479500a8eada6a032e07eac5bd43142367ee5b0ab1df9'; ` + ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ((Get-FileHash $env:SystemDrive\go-amd64.msi -Algorithm sha256).Hash -ne $sha256) { ` + Write-Host 'Checksum Go Lang failed!'; ` + exit 1; ` + }; ` + Write-Host 'Installing ...'; ` + Start-Process ` + -FilePath $env:SystemDrive\go-amd64.msi ` + -Wait ` + -ArgumentList '/qn /norestart'; ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Path $env:SystemDrive\go-amd64.msi; ` + ` + $env:PATH = [string]::Format('{0}\Go\bin;', ${env:ProgramFiles}) + $env:PATH; ` + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); ` + Write-Host 'Verifying install ("go version") ...'; ` + go version; ` + ` + Write-Host ('Downloading {0} ...' -f $env:SEVEN_ZIP_URL); ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + Invoke-WebRequest -OutFile $env:SystemDrive\7z.msi -Uri $env:SEVEN_ZIP_URL; ` + ` + $sha256 = 'a7803233eedb6a4b59b3024ccf9292a6fffb94507dc998aa67c5b745d197a5dc'; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ((Get-FileHash $env:SystemDrive\7z.msi -Algorithm sha256).Hash -ne $sha256) { ` + Write-Host 'Checksum 7-zip failed!'; ` + exit 1; ` + }; ` + ` + Write-Host 'Installing ...'; ` + Start-Process ` + -FilePath $env:SystemDrive\7z.msi ` + -Wait ` + -ArgumentList '/qn /norestart'; ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Path $env:SystemDrive\7z.msi; ` + $env:PATH = [string]::Format('{0}\7-Zip;', ${env:ProgramFiles}) + $env:PATH; ` + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); ` + ` + Write-Host 'Verifying install ("7z -h") ...'; ` + 7z -h | Select -first 2; ` + ` + Write-Host ('Downloading {0} ...' -f $env:MINGW_URL); ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + (new-object System.Net.WebClient).DownloadFile("""$env:MINGW_URL""","""$env:SystemDrive\mingw.7z"""); ` + ` + $sha256 = 'e8c65ddc655534b0330f66f7b480565621e8617cda9937d76ba141a22bf3b2fa'; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ((Get-FileHash $env:SystemDrive\mingw.7z -Algorithm sha256).Hash -ne $sha256) { ` + Write-Host 'Checksum Mingw-w64 failed!'; ` + exit 1; ` + }; ` + ` + Write-Host 'Installing ...'; ` + 7z x $env:SystemDrive\mingw.7z; ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Path $env:SystemDrive\mingw.7z; ` + $env:PATH = [string]::Format('{0}\mingw64\bin;', $env:SystemDrive) + $env:PATH; ` + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); ` + ` + Write-Host 'Verifying install ("mingw32-make -v") ...'; ` + mingw32-make -v; ` + ` + Write-Host ('Downloading {0} ...' -f $env:VS_BUILDTOOLS_URL); ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + Invoke-WebRequest -OutFile $env:SystemDrive\vs_buildtools.exe $env:VS_BUILDTOOLS_URL; ` + ` + Write-Host ('{0} - Visual Studio components installing...' -f $(Get-Date -format 'u')); ` + cmd /C start /w $env:SystemDrive\vs_buildtools.exe ` + --quiet ` + --wait ` + --norestart ` + --nocache modify ` + --installPath """${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\BuildTools""" ` + # https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2019 + --add Microsoft.VisualStudio.Component.Windows10SDK.19041 ` + --add Microsoft.VisualStudio.Component.VC.CMake.Project; ` + if ($err = dir $Env:TEMP -Filter dd_setup_*_errors.log | where Length -gt 0 | Get-Content) { ` + throw $err; ` + }; ` + Wait-Process -name msiexec; ` + Write-Host ('{0} - Visual Studio components installed' -f $(Get-Date -format 'u')); ` + ` + Write-Host 'Visual Studio components installation cleanup'; ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Path $env:SystemDrive\vs_buildtools.exe; ` + Get-ChildItem -Path """${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer""" -Directory -Recurse | Remove-Item -Force –Recurse; ` + Remove-Item -Force -Recurse $env:TEMP\*; ` + Write-Host 'Build environment is ready...'; + +RUN Set-Location -Path $env:SystemDrive\.; ` + ` + Import-Module ('{0}\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll' -f ${env:ProgramFiles(x86)} ); ` + Enter-VsDevShell -VsInstallPath ('{0}\Microsoft Visual Studio\2019\BuildTools' -f ${env:ProgramFiles(x86)}) -DevCmdArguments """-arch=$env:BUILD_ARCH"""; ` + ` + Write-Host ('Downloading {0} ...' -f $env:PCRE_URL); ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + Invoke-WebRequest -OutFile $env:SystemDrive\pcre.zip -Uri $env:PCRE_URL; ` + ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + $sha256 = '5b709aa45ea3b8bb73052947200ad187f651a2049158fb5bbfed329e4322a977'; ` + if ((Get-FileHash $env:SystemDrive\pcre.zip -Algorithm sha256).Hash -ne $sha256) { ` + Write-Host 'Checksum PCRE library failed!'; ` + exit 1; ` + }; ` + Write-Host 'Extracting archive ...'; ` + Expand-Archive -Path $env:SystemDrive\pcre.zip -DestinationPath $env:SystemDrive; ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Path $env:SystemDrive\pcre.zip; ` + Rename-Item -Path $env:SystemDrive\pcre-$env:PCRE_VERSION -NewName $env:SystemDrive\pcre_build; ` + ` + Set-Location -Path $env:SystemDrive\pcre_build; ` + Write-Host 'Building PCRE library ...'; ` + cmake --log-level=ERROR ` + -G 'MinGW Makefiles' ` + -DBUILD_SHARED_LIBS=OFF ` + -DCMAKE_C_COMPILER=gcc ` + -DCMAKE_C_FLAGS='-O2 -g' ` + -DCMAKE_CXX_FLAGS='-O2 -g' ` + -DCMAKE_INSTALL_PREFIX="""$env:SystemDrive\pcre_output""" . ; ` + mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS"""; ` + mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" install; ` + Write-Host 'PCRE is ready...'; + +RUN Set-Location -Path $env:SystemDrive\.; ` + ` + Write-Host ('Downloading {0} ...' -f $env:CYGWIN_URL); ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + (New-Object Net.WebClient).DownloadFile("""$env:CYGWIN_URL""", """$env:SystemDrive\setup.exe"""); ` + ` + $sha256 = 'b9219acd1241ffa4d38e19587f1ccc2854f951e451f3858efc9d2e1fe19d375c'; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ((Get-FileHash $env:SystemDrive\setup.exe -Algorithm sha256).Hash -ne $sha256) { ` + Write-Host 'Checksum Cygwin failed!'; ` + exit 1; ` + }; ` + Write-Host 'Installing ...'; ` + Start-Process $env:SystemDrive\setup.exe ` + -ArgumentList """-qnNdO -a x86_64 -R $env:SystemDrive\cygwin --site http://cygwin.mirror.constant.com -l $env:SystemDrive\cygwin\var\cache\setup --packages perl""" ` + -Wait ` + -NoNewWindow; ` + ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Path $env:SystemDrive\setup.exe; ` + Write-Host ('Downloading {0} ...' -f $env:OPENSSL_URL); ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + Invoke-WebRequest -OutFile $env:SystemDrive\openssl.tar.gz -Uri $env:OPENSSL_URL; ` + ` + $sha256 = '0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1'; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ((Get-FileHash $env:SystemDrive\openssl.tar.gz -Algorithm sha256).Hash -ne $sha256) { ` + Write-Host 'Checksum OpenSSL library failed!'; ` + exit 1; ` + }; ` + ` + Write-Host 'Extracting archive ...'; ` + tar -zxf $env:SystemDrive\openssl.tar.gz; ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Path $env:SystemDrive\openssl.tar.gz; ` + Rename-Item -Path $env:SystemDrive\openssl-$env:OPENSSL_VERSION -NewName $env:SystemDrive\openssl_build; ` + ` + Write-Host 'Building OpenSSL library...'; ` + Set-Location -Path $env:SystemDrive\openssl_build; ` + $env:PATH+=""";$env:SystemDrive\cygwin\bin"""; ` + perl Configure ` + mingw64 ` + no-shared ` + no-ui-console ` + no-tests ` +# enable-capieng ` + no-capieng ` + --api=1.1.0 ` + --prefix=$env:SystemDrive\openssl_output ` + --openssldir=$env:SystemDrive\openssl_output_ssl; ` + mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS"""; ` + mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" install_sw; ` + Write-Host 'OpenSSL is ready...'; ` + Write-Host 'Removing cygwin...'; ` + Remove-Item -Recurse -Force -Path $env:SystemDrive\cygwin; diff --git a/Dockerfiles/build-mysql/alpine/.dockerignore b/Dockerfiles/build-mysql/alpine/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/Dockerfiles/build-mysql/alpine/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/Dockerfiles/build-mysql/alpine/Dockerfile b/Dockerfiles/build-mysql/alpine/Dockerfile new file mode 100644 index 000000000..0643899a9 --- /dev/null +++ b/Dockerfiles/build-mysql/alpine/Dockerfile @@ -0,0 +1,69 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-base:alpine-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +LABEL org.opencontainers.image.title="Zabbix build base (MySQL)" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base for MySQL based images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +RUN set -eux && \ + cd /tmp/ && \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch /tmp/zabbix-${ZBX_VERSION} && \ + cd /tmp/zabbix-${ZBX_VERSION} && \ + zabbix_revision=`git rev-parse --short HEAD` && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/go/pkg/version/version.go && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \ + ./bootstrap.sh && \ + export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ + ./configure \ + --datadir=/usr/lib \ + --libdir=/usr/lib/zabbix \ + --prefix=/usr \ + --sysconfdir=/etc/zabbix \ + --enable-agent \ + --enable-agent2 \ + --enable-server \ + --enable-proxy \ + --with-mysql \ + --with-ldap \ + --with-libcurl \ + --with-libxml2 \ + --enable-java \ + --with-net-snmp \ + --with-openipmi \ + --with-openssl \ + --with-ssh \ + --with-unixodbc \ + --enable-ipv6 \ + --silent && \ + make -j"$(nproc)" -s dbschema && \ + make -j"$(nproc)" -s && \ + make -j"$(nproc)" -s gettext && \ + cat database/mysql/schema.sql > database/mysql/create.sql && \ + cat database/mysql/images.sql >> database/mysql/create.sql && \ + cat database/mysql/data.sql >> database/mysql/create.sql && \ + gzip -c database/mysql/create.sql > database/mysql/create_server.sql.gz && \ + rm -rf database/mysql/create.sql && \ + cat database/mysql/schema.sql > database/mysql/create.sql && \ + gzip -c database/mysql/create.sql > database/mysql/create_proxy.sql.gz && \ + rm -rf database/mysql/create.sql && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender diff --git a/Dockerfiles/build-mysql/alpine/build.sh b/Dockerfiles/build-mysql/alpine/build.sh new file mode 120000 index 000000000..46b203134 --- /dev/null +++ b/Dockerfiles/build-mysql/alpine/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/Dockerfiles/build-mysql/centos/.dockerignore b/Dockerfiles/build-mysql/centos/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/Dockerfiles/build-mysql/centos/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/Dockerfiles/build-mysql/centos/Dockerfile b/Dockerfiles/build-mysql/centos/Dockerfile new file mode 100644 index 000000000..0d3a4eb8d --- /dev/null +++ b/Dockerfiles/build-mysql/centos/Dockerfile @@ -0,0 +1,70 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-base:centos-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +LABEL org.opencontainers.image.title="Zabbix build base (MySQL)" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base for MySQL based images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +RUN set -eux && \ + cd /tmp/ && \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch /tmp/zabbix-${ZBX_VERSION} && \ + cd /tmp/zabbix-${ZBX_VERSION} && \ + zabbix_revision=`git rev-parse --short HEAD` && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/go/pkg/version/version.go && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \ + ./bootstrap.sh && \ + export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ + ./configure \ + --datadir=/usr/lib \ + --libdir=/usr/lib/zabbix \ + --prefix=/usr \ + --sysconfdir=/etc/zabbix \ + --enable-agent \ + --enable-agent2 \ + --enable-server \ + --enable-proxy \ + --enable-webservice \ + --with-mysql \ + --with-ldap \ + --with-libcurl \ + --with-libxml2 \ + --enable-java \ + --with-net-snmp \ + --with-openipmi \ + --with-openssl \ + --with-ssh \ + --with-unixodbc \ + --enable-ipv6 \ + --silent && \ + make -j"$(nproc)" -s dbschema && \ + make -j"$(nproc)" -s && \ + make -j"$(nproc)" -s gettext && \ + cat database/mysql/schema.sql > database/mysql/create.sql && \ + cat database/mysql/images.sql >> database/mysql/create.sql && \ + cat database/mysql/data.sql >> database/mysql/create.sql && \ + gzip -c database/mysql/create.sql > database/mysql/create_server.sql.gz && \ + rm -rf database/mysql/create.sql && \ + cat database/mysql/schema.sql > database/mysql/create.sql && \ + gzip -c database/mysql/create.sql > database/mysql/create_proxy.sql.gz && \ + rm -rf database/mysql/create.sql && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender diff --git a/Dockerfiles/build-mysql/centos/build.sh b/Dockerfiles/build-mysql/centos/build.sh new file mode 120000 index 000000000..46b203134 --- /dev/null +++ b/Dockerfiles/build-mysql/centos/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/Dockerfiles/build-mysql/ol/.dockerignore b/Dockerfiles/build-mysql/ol/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/Dockerfiles/build-mysql/ol/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/Dockerfiles/build-mysql/ol/Dockerfile b/Dockerfiles/build-mysql/ol/Dockerfile new file mode 100644 index 000000000..f5f1af14b --- /dev/null +++ b/Dockerfiles/build-mysql/ol/Dockerfile @@ -0,0 +1,69 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-base:ol-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +LABEL org.opencontainers.image.title="Zabbix build base (MySQL)" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base for MySQL based images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +RUN set -eux && \ + cd /tmp/ && \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch /tmp/zabbix-${ZBX_VERSION} && \ + cd /tmp/zabbix-${ZBX_VERSION} && \ + zabbix_revision=`git rev-parse --short HEAD` && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/go/pkg/version/version.go && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \ + ./bootstrap.sh && \ + export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ + ./configure \ + --datadir=/usr/lib \ + --libdir=/usr/lib/zabbix \ + --prefix=/usr \ + --sysconfdir=/etc/zabbix \ + --enable-agent \ + --enable-agent2 \ + --enable-server \ + --enable-proxy \ + --with-mysql \ + --with-ldap \ + --with-libcurl \ + --with-libxml2 \ + --enable-java \ + --with-net-snmp \ + --with-openipmi \ + --with-openssl \ + --with-ssh \ + --with-unixodbc \ + --enable-ipv6 \ + --silent && \ + make -j"$(nproc)" -s dbschema && \ + make -j"$(nproc)" -s && \ + make -j"$(nproc)" -s gettext && \ + cat database/mysql/schema.sql > database/mysql/create.sql && \ + cat database/mysql/images.sql >> database/mysql/create.sql && \ + cat database/mysql/data.sql >> database/mysql/create.sql && \ + gzip -c database/mysql/create.sql > database/mysql/create_server.sql.gz && \ + rm -rf database/mysql/create.sql && \ + cat database/mysql/schema.sql > database/mysql/create.sql && \ + gzip -c database/mysql/create.sql > database/mysql/create_proxy.sql.gz && \ + rm -rf database/mysql/create.sql && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender diff --git a/Dockerfiles/build-mysql/ol/build.sh b/Dockerfiles/build-mysql/ol/build.sh new file mode 120000 index 000000000..46b203134 --- /dev/null +++ b/Dockerfiles/build-mysql/ol/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/Dockerfiles/build-mysql/ubuntu/.dockerignore b/Dockerfiles/build-mysql/ubuntu/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/Dockerfiles/build-mysql/ubuntu/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/Dockerfiles/build-mysql/ubuntu/Dockerfile b/Dockerfiles/build-mysql/ubuntu/Dockerfile new file mode 100644 index 000000000..cea6c6d4c --- /dev/null +++ b/Dockerfiles/build-mysql/ubuntu/Dockerfile @@ -0,0 +1,69 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-base:ubuntu-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +LABEL org.opencontainers.image.title="Zabbix build base (MySQL)" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base for MySQL based images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +RUN set -eux && \ + cd /tmp/ && \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch /tmp/zabbix-${ZBX_VERSION} && \ + cd /tmp/zabbix-${ZBX_VERSION} && \ + zabbix_revision=`git rev-parse --short HEAD` && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/go/pkg/version/version.go && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \ + ./bootstrap.sh && \ + export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ + ./configure \ + --datadir=/usr/lib \ + --libdir=/usr/lib/zabbix \ + --prefix=/usr \ + --sysconfdir=/etc/zabbix \ + --enable-agent \ + --enable-agent2 \ + --enable-server \ + --enable-proxy \ + --with-mysql \ + --with-ldap \ + --with-libcurl \ + --with-libxml2 \ + --enable-java \ + --with-net-snmp \ + --with-openipmi \ + --with-openssl \ + --with-ssh \ + --with-unixodbc \ + --enable-ipv6 \ + --silent && \ + make -j"$(nproc)" -s dbschema && \ + make -j"$(nproc)" -s && \ + make -j"$(nproc)" -s gettext && \ + cat database/mysql/schema.sql > database/mysql/create.sql && \ + cat database/mysql/images.sql >> database/mysql/create.sql && \ + cat database/mysql/data.sql >> database/mysql/create.sql && \ + gzip -c database/mysql/create.sql > database/mysql/create_server.sql.gz && \ + rm -rf database/mysql/create.sql && \ + cat database/mysql/schema.sql > database/mysql/create.sql && \ + gzip -c database/mysql/create.sql > database/mysql/create_proxy.sql.gz && \ + rm -rf database/mysql/create.sql && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender diff --git a/Dockerfiles/build-mysql/ubuntu/build.sh b/Dockerfiles/build-mysql/ubuntu/build.sh new file mode 120000 index 000000000..46b203134 --- /dev/null +++ b/Dockerfiles/build-mysql/ubuntu/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/Dockerfiles/build-mysql/windows/Dockerfile.agent b/Dockerfiles/build-mysql/windows/Dockerfile.agent new file mode 100644 index 000000000..65005d337 --- /dev/null +++ b/Dockerfiles/build-mysql/windows/Dockerfile.agent @@ -0,0 +1,65 @@ +# syntax=docker/dockerfile:1 +# escape=` +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-base:ltsc2022-agent-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git +ARG ZABBIX_VERSION_RC_NUM=2400 +ARG ZBX_COMPONENT=all +ENV ZBX_SOURCES=$ZBX_SOURCES MAJOR_VERSION=$MAJOR_VERSION ZBX_VERSION=$ZBX_VERSION ZABBIX_VERSION_RC_NUM=$ZABBIX_VERSION_RC_NUM + +LABEL org.opencontainers.image.title="Zabbix agent build (Windows)" ` + org.opencontainers.image.authors="Alexey Pustovalov " ` + org.opencontainers.image.vendor="Zabbix LLC" ` + org.opencontainers.image.url="https://zabbix.com/" ` + org.opencontainers.image.description="Zabbix build for agent images based on Windows" ` + org.opencontainers.image.licenses="GPL v2.0" ` + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" ` + org.opencontainers.image.version="${ZBX_VERSION}" ` + org.opencontainers.image.source="${ZBX_SOURCES}" + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +RUN Set-Location -Path $env:SystemDrive\.; ` + ` + Import-Module ('{0}\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll' -f ${env:ProgramFiles(x86)} ); ` + Enter-VsDevShell -VsInstallPath ('{0}\Microsoft Visual Studio\2019\BuildTools' -f ${env:ProgramFiles(x86)}) -DevCmdArguments """-arch=$env:BUILD_ARCH"""; ` + ` + Write-Host ('Checkout GIT {0} ({1}) repository ...' -f $env:ZBX_SOURCES, $env:ZBX_VERSION); ` + git -c advice.detachedHead=false clone $env:ZBX_SOURCES --branch $env:ZBX_VERSION --depth 1 --single-branch $env:SystemDrive\zabbix-$env:ZBX_VERSION; ` + ` + Write-Host ('Building Zabbix {0} version ...' -f $env:ZBX_VERSION); ` + Set-Location -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION; ` + $ZbxRevision=(git rev-parse --short HEAD); ` + (Get-Content include/version.h).replace('{ZABBIX_REVISION}', $ZbxRevision) | Set-Content include/version.h; ` + Set-Location -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\build\win32\project; ` + set CL=/MP; ` + nmake /S -f Makefile ` + CPU=$env:CPU_MODEL ` + CFLAGS="""/D ZABBIX_VERSION_REVISION=$ZbxRevision""" ` + PCREINCDIR=$env:SystemDrive\pcre_build\build ` + PCRELIBDIR=$env:SystemDrive\pcre_build\build\Release TLS=openssl ` + RFLAGS="""/D ZABBIX_VERSION_REVISION=$ZbxRevision /D ZABBIX_VERSION_RC_NUM=$env:ZABBIX_VERSION_RC_NUM""" ` +# LIBS="Crypt32.lib" ` + TLSINCDIR=$env:SystemDrive\openssl_output\include ` + TLSLIBDIR=$env:SystemDrive\openssl_output\lib ` + $env:ZBX_COMPONENT; ` + ` + Write-Host 'Verifying build ("zabbix_agentd.exe -V") ...'; ` + & $env:SystemDrive\zabbix-$env:ZBX_VERSION\bin\win64\zabbix_agentd.exe -V; ` + dumpbin /dependents $env:SystemDrive\zabbix-$env:ZBX_VERSION\bin\win64\zabbix_agentd.exe; ` + ` + New-Item -ItemType directory -Path $env:SystemDrive\zabbix | Out-Null; ` + New-Item -ItemType directory -Path $env:SystemDrive\zabbix\sbin | Out-Null; ` + New-Item -ItemType directory -Path $env:SystemDrive\zabbix\conf | Out-Null; ` + ` + Copy-Item -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\bin\win64\zabbix_agentd.exe $env:SystemDrive\zabbix\sbin; ` + Copy-Item -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\bin\win64\zabbix_get.exe $env:SystemDrive\zabbix\sbin; ` + Copy-Item -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\bin\win64\zabbix_sender.exe $env:SystemDrive\zabbix\sbin; ` + Copy-Item -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\conf\zabbix_agentd.win.conf $env:SystemDrive\zabbix\conf; ` + Write-Host 'Zabbix binaries are compiled...'; diff --git a/Dockerfiles/build-mysql/windows/Dockerfile.agent2 b/Dockerfiles/build-mysql/windows/Dockerfile.agent2 new file mode 100644 index 000000000..40469bb5f --- /dev/null +++ b/Dockerfiles/build-mysql/windows/Dockerfile.agent2 @@ -0,0 +1,57 @@ +# syntax=docker/dockerfile:1 +# escape=` +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-base:ltsc2022-agent2-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ARG MAJOR_VERSION=6.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.0 +ARG ZABBIX_VERSION_RC_NUM=2400 +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git +ARG ZBX_COMPONENT=all +ENV ZBX_SOURCES=$ZBX_SOURCES MAJOR_VERSION=$MAJOR_VERSION ZBX_VERSION=$ZBX_VERSION + +LABEL org.opencontainers.image.title="Zabbix agent 2 build (Windows)" ` + org.opencontainers.image.authors="Alexey Pustovalov " ` + org.opencontainers.image.vendor="Zabbix LLC" ` + org.opencontainers.image.url="https://zabbix.com/" ` + org.opencontainers.image.description="Zabbix build for agent 2 images based on Windows" ` + org.opencontainers.image.licenses="GPL v2.0" ` + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" ` + org.opencontainers.image.version="${ZBX_VERSION}" ` + org.opencontainers.image.source="${ZBX_SOURCES}" + +RUN Set-Location -Path $env:SystemDrive\.; ` + ` + Import-Module ('{0}\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll' -f ${env:ProgramFiles(x86)} ); ` + Enter-VsDevShell -VsInstallPath ('{0}\Microsoft Visual Studio\2019\BuildTools' -f ${env:ProgramFiles(x86)}) -DevCmdArguments """-arch=$env:BUILD_ARCH"""; ` + ` + Write-Host ('Checkout GIT {0} ({}) repository ...' -f $env:ZBX_SOURCES, $env:ZBX_VERSION); ` + git -c advice.detachedHead=false clone $env:ZBX_SOURCES --branch $env:ZBX_VERSION --depth 1 --single-branch $env:SystemDrive\zabbix-$env:ZBX_VERSION; ` + ` + Write-Host ('Building Zabbix {0} version ...' -f $env:ZBX_VERSION); ` + Set-Location -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION; ` + $ZbxRevision=(git rev-parse --short HEAD); ` + (Get-Content src\go\pkg\version\version.go).replace('{ZABBIX_REVISION}', $ZbxRevision) | Set-Content src\go\pkg\version\version.go; ` + Set-Location -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\build\mingw; ` + mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" ` +# CGO_LDFLAGS="""-lssl -lcrypto -lcrypt32 -L$env:SystemDrive\openssl_output\lib -L$env:SystemDrive\pcre_output\lib""" ` + PCRE=$env:SystemDrive\pcre_output ` + OPENSSL=$env:SystemDrive\openssl_output ` + RFLAGS="""-DZABBIX_VERSION_RC_NUM=$env:ZABBIX_VERSION_RC_NUM"""; ` + ` + Write-Host 'Verifying build ("zabbix_agent2.exe -V") ...'; ` + & $env:SystemDrive\zabbix-$env:ZBX_VERSION\bin\win64\zabbix_agent2.exe -V; ` + dumpbin /dependents $env:SystemDrive\zabbix-$env:ZBX_VERSION\bin\win64\zabbix_agent2.exe; ` + ` + New-Item -ItemType directory -Path $env:SystemDrive\zabbix2 | Out-Null; ` + New-Item -ItemType directory -Path $env:SystemDrive\zabbix2\sbin | Out-Null; ` + New-Item -ItemType directory -Path $env:SystemDrive\zabbix2\conf | Out-Null; ` + ` + Copy-Item -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\bin\win64\zabbix_agent2.exe $env:SystemDrive\zabbix2\sbin; ` + Copy-Item -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\src\go\conf\zabbix_agent2.win.conf $env:SystemDrive\zabbix2\conf; ` + Write-Host 'Zabbix binaries are compiled...'; diff --git a/Dockerfiles/build-pgsql/alpine/.dockerignore b/Dockerfiles/build-pgsql/alpine/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/Dockerfiles/build-pgsql/alpine/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/Dockerfiles/build-pgsql/alpine/Dockerfile b/Dockerfiles/build-pgsql/alpine/Dockerfile new file mode 100644 index 000000000..f605633e6 --- /dev/null +++ b/Dockerfiles/build-pgsql/alpine/Dockerfile @@ -0,0 +1,69 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-base:alpine-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +LABEL org.opencontainers.image.title="Zabbix build base (PostgreSQL)" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base for PostgreSQL based images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +RUN set -eux && \ + cd /tmp/ && \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch /tmp/zabbix-${ZBX_VERSION} && \ + cd /tmp/zabbix-${ZBX_VERSION} && \ + zabbix_revision=`git rev-parse --short HEAD` && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/go/pkg/version/version.go && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \ + ./bootstrap.sh && \ + export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ + ./configure \ + --datadir=/usr/lib \ + --libdir=/usr/lib/zabbix \ + --prefix=/usr \ + --sysconfdir=/etc/zabbix \ + --enable-agent \ + --enable-agent2 \ + --enable-server \ + --enable-proxy \ + --with-postgresql \ + --with-ldap \ + --with-libcurl \ + --with-libxml2 \ + --enable-java \ + --with-net-snmp \ + --with-openipmi \ + --with-openssl \ + --with-ssh \ + --with-unixodbc \ + --enable-ipv6 \ + --silent && \ + make -j"$(nproc)" -s dbschema && \ + make -j"$(nproc)" -s && \ + make -j"$(nproc)" -s gettext && \ + cat database/postgresql/schema.sql > database/postgresql/create.sql && \ + cat database/postgresql/images.sql >> database/postgresql/create.sql && \ + cat database/postgresql/data.sql >> database/postgresql/create.sql && \ + gzip -c database/postgresql/create.sql > database/postgresql/create_server.sql.gz && \ + rm -rf database/postgresql/create.sql && \ + cat database/postgresql/schema.sql > database/postgresql/create.sql && \ + gzip -c database/postgresql/create.sql > database/postgresql/create_proxy.sql.gz && \ + rm -rf database/postgresql/create.sql && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender diff --git a/Dockerfiles/build-pgsql/alpine/build.sh b/Dockerfiles/build-pgsql/alpine/build.sh new file mode 120000 index 000000000..46b203134 --- /dev/null +++ b/Dockerfiles/build-pgsql/alpine/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/Dockerfiles/build-pgsql/centos/.dockerignore b/Dockerfiles/build-pgsql/centos/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/Dockerfiles/build-pgsql/centos/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/Dockerfiles/build-pgsql/centos/Dockerfile b/Dockerfiles/build-pgsql/centos/Dockerfile new file mode 100644 index 000000000..9ebcb6d98 --- /dev/null +++ b/Dockerfiles/build-pgsql/centos/Dockerfile @@ -0,0 +1,69 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-base:centos-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +LABEL org.opencontainers.image.title="Zabbix build base (PostgreSQL)" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base for PostgreSQL based images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +RUN set -eux && \ + cd /tmp/ && \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch /tmp/zabbix-${ZBX_VERSION} && \ + cd /tmp/zabbix-${ZBX_VERSION} && \ + zabbix_revision=`git rev-parse --short HEAD` && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/go/pkg/version/version.go && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \ + ./bootstrap.sh && \ + export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ + ./configure \ + --datadir=/usr/lib \ + --libdir=/usr/lib/zabbix \ + --prefix=/usr \ + --sysconfdir=/etc/zabbix \ + --enable-agent \ + --enable-agent2 \ + --enable-server \ + --enable-proxy \ + --with-postgresql \ + --with-ldap \ + --with-libcurl \ + --with-libxml2 \ + --enable-java \ + --with-net-snmp \ + --with-openipmi \ + --with-openssl \ + --with-ssh \ + --with-unixodbc \ + --enable-ipv6 \ + --silent && \ + make -j"$(nproc)" -s dbschema && \ + make -j"$(nproc)" -s && \ + make -j"$(nproc)" -s gettext && \ + cat database/postgresql/schema.sql > database/postgresql/create.sql && \ + cat database/postgresql/images.sql >> database/postgresql/create.sql && \ + cat database/postgresql/data.sql >> database/postgresql/create.sql && \ + gzip -c database/postgresql/create.sql > database/postgresql/create_server.sql.gz && \ + rm -rf database/postgresql/create.sql && \ + cat database/postgresql/schema.sql > database/postgresql/create.sql && \ + gzip -c database/postgresql/create.sql > database/postgresql/create_proxy.sql.gz && \ + rm -rf database/postgresql/create.sql && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender diff --git a/Dockerfiles/build-pgsql/centos/build.sh b/Dockerfiles/build-pgsql/centos/build.sh new file mode 120000 index 000000000..46b203134 --- /dev/null +++ b/Dockerfiles/build-pgsql/centos/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/Dockerfiles/build-pgsql/ol/.dockerignore b/Dockerfiles/build-pgsql/ol/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/Dockerfiles/build-pgsql/ol/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/Dockerfiles/build-pgsql/ol/Dockerfile b/Dockerfiles/build-pgsql/ol/Dockerfile new file mode 100644 index 000000000..2dbec5f3b --- /dev/null +++ b/Dockerfiles/build-pgsql/ol/Dockerfile @@ -0,0 +1,70 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-base:ol-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +LABEL org.opencontainers.image.title="Zabbix build base (PostgreSQL)" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base for PostgreSQL based images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +RUN set -eux && \ + cd /tmp/ && \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch /tmp/zabbix-${ZBX_VERSION} && \ + cd /tmp/zabbix-${ZBX_VERSION} && \ + zabbix_revision=`git rev-parse --short HEAD` && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/go/pkg/version/version.go && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \ + ./bootstrap.sh && \ + export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ + ./configure \ + --datadir=/usr/lib \ + --libdir=/usr/lib/zabbix \ + --prefix=/usr \ + --sysconfdir=/etc/zabbix \ + --enable-agent \ + --enable-agent2 \ + --enable-server \ + --enable-proxy \ + --enable-webservice \ + --with-postgresql \ + --with-ldap \ + --with-libcurl \ + --with-libxml2 \ + --enable-java \ + --with-net-snmp \ + --with-openipmi \ + --with-openssl \ + --with-ssh \ + --with-unixodbc \ + --enable-ipv6 \ + --silent && \ + make -j"$(nproc)" -s dbschema && \ + make -j"$(nproc)" -s && \ + make -j"$(nproc)" -s gettext && \ + cat database/postgresql/schema.sql > database/postgresql/create.sql && \ + cat database/postgresql/images.sql >> database/postgresql/create.sql && \ + cat database/postgresql/data.sql >> database/postgresql/create.sql && \ + gzip -c database/postgresql/create.sql > database/postgresql/create_server.sql.gz && \ + rm -rf database/postgresql/create.sql && \ + cat database/postgresql/schema.sql > database/postgresql/create.sql && \ + gzip -c database/postgresql/create.sql > database/postgresql/create_proxy.sql.gz && \ + rm -rf database/postgresql/create.sql && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender diff --git a/Dockerfiles/build-pgsql/ol/build.sh b/Dockerfiles/build-pgsql/ol/build.sh new file mode 120000 index 000000000..46b203134 --- /dev/null +++ b/Dockerfiles/build-pgsql/ol/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/Dockerfiles/build-pgsql/ubuntu/.dockerignore b/Dockerfiles/build-pgsql/ubuntu/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/Dockerfiles/build-pgsql/ubuntu/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/Dockerfiles/build-pgsql/ubuntu/Dockerfile b/Dockerfiles/build-pgsql/ubuntu/Dockerfile new file mode 100644 index 000000000..0c066ae71 --- /dev/null +++ b/Dockerfiles/build-pgsql/ubuntu/Dockerfile @@ -0,0 +1,69 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-base:ubuntu-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +LABEL org.opencontainers.image.title="Zabbix build base (PostgreSQL)" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base for PostgreSQL based images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +RUN set -eux && \ + cd /tmp/ && \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch /tmp/zabbix-${ZBX_VERSION} && \ + cd /tmp/zabbix-${ZBX_VERSION} && \ + zabbix_revision=`git rev-parse --short HEAD` && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/go/pkg/version/version.go && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \ + ./bootstrap.sh && \ + export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ + ./configure \ + --datadir=/usr/lib \ + --libdir=/usr/lib/zabbix \ + --prefix=/usr \ + --sysconfdir=/etc/zabbix \ + --enable-agent \ + --enable-agent2 \ + --enable-server \ + --enable-proxy \ + --with-postgresql \ + --with-ldap \ + --with-libcurl \ + --with-libxml2 \ + --enable-java \ + --with-net-snmp \ + --with-openipmi \ + --with-openssl \ + --with-ssh \ + --with-unixodbc \ + --enable-ipv6 \ + --silent && \ + make -j"$(nproc)" -s dbschema && \ + make -j"$(nproc)" -s && \ + make -j"$(nproc)" -s gettext && \ + cat database/postgresql/schema.sql > database/postgresql/create.sql && \ + cat database/postgresql/images.sql >> database/postgresql/create.sql && \ + cat database/postgresql/data.sql >> database/postgresql/create.sql && \ + gzip -c database/postgresql/create.sql > database/postgresql/create_server.sql.gz && \ + rm -rf database/postgresql/create.sql && \ + cat database/postgresql/schema.sql > database/postgresql/create.sql && \ + gzip -c database/postgresql/create.sql > database/postgresql/create_proxy.sql.gz && \ + rm -rf database/postgresql/create.sql && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender diff --git a/Dockerfiles/build-pgsql/ubuntu/build.sh b/Dockerfiles/build-pgsql/ubuntu/build.sh new file mode 120000 index 000000000..46b203134 --- /dev/null +++ b/Dockerfiles/build-pgsql/ubuntu/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/Dockerfiles/build-sqlite3/alpine/.dockerignore b/Dockerfiles/build-sqlite3/alpine/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/Dockerfiles/build-sqlite3/alpine/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/Dockerfiles/build-sqlite3/alpine/Dockerfile b/Dockerfiles/build-sqlite3/alpine/Dockerfile new file mode 100644 index 000000000..653f02212 --- /dev/null +++ b/Dockerfiles/build-sqlite3/alpine/Dockerfile @@ -0,0 +1,58 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-base:alpine-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +LABEL org.opencontainers.image.title="Zabbix build base (SQLite3)" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base for SQLite3 based images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +RUN set -eux && \ + cd /tmp/ && \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch /tmp/zabbix-${ZBX_VERSION} && \ + cd /tmp/zabbix-${ZBX_VERSION} && \ + zabbix_revision=`git rev-parse --short HEAD` && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/go/pkg/version/version.go && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \ + ./bootstrap.sh && \ + export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ + ./configure \ + --datadir=/usr/lib \ + --libdir=/usr/lib/zabbix \ + --prefix=/usr \ + --sysconfdir=/etc/zabbix \ + --enable-agent \ + --enable-agent2 \ + --enable-proxy \ + --with-sqlite3 \ + --with-ldap \ + --with-libcurl \ + --with-libxml2 \ + --enable-java \ + --with-net-snmp \ + --with-openipmi \ + --with-openssl \ + --with-ssh \ + --with-unixodbc \ + --enable-ipv6 \ + --silent && \ + make -j"$(nproc)" -s dbschema && \ + make -j"$(nproc)" -s && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender diff --git a/Dockerfiles/build-sqlite3/alpine/build.sh b/Dockerfiles/build-sqlite3/alpine/build.sh new file mode 120000 index 000000000..46b203134 --- /dev/null +++ b/Dockerfiles/build-sqlite3/alpine/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/Dockerfiles/build-sqlite3/centos/.dockerignore b/Dockerfiles/build-sqlite3/centos/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/Dockerfiles/build-sqlite3/centos/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/Dockerfiles/build-sqlite3/centos/Dockerfile b/Dockerfiles/build-sqlite3/centos/Dockerfile new file mode 100644 index 000000000..704e6b33e --- /dev/null +++ b/Dockerfiles/build-sqlite3/centos/Dockerfile @@ -0,0 +1,58 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-base:centos-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +LABEL org.opencontainers.image.title="Zabbix build base (SQLite3)" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base for SQLite3 based images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +RUN set -eux && \ + cd /tmp/ && \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch /tmp/zabbix-${ZBX_VERSION} && \ + cd /tmp/zabbix-${ZBX_VERSION} && \ + zabbix_revision=`git rev-parse --short HEAD` && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/go/pkg/version/version.go && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \ + ./bootstrap.sh && \ + export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ + ./configure \ + --datadir=/usr/lib \ + --libdir=/usr/lib/zabbix \ + --prefix=/usr \ + --sysconfdir=/etc/zabbix \ + --enable-agent \ + --enable-agent2 \ + --enable-proxy \ + --with-sqlite3 \ + --with-ldap \ + --with-libcurl \ + --with-libxml2 \ + --enable-java \ + --with-net-snmp \ + --with-openipmi \ + --with-openssl \ + --with-ssh \ + --with-unixodbc \ + --enable-ipv6 \ + --silent && \ + make -j"$(nproc)" -s dbschema && \ + make -j"$(nproc)" -s && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender \ No newline at end of file diff --git a/Dockerfiles/build-sqlite3/centos/build.sh b/Dockerfiles/build-sqlite3/centos/build.sh new file mode 120000 index 000000000..46b203134 --- /dev/null +++ b/Dockerfiles/build-sqlite3/centos/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/Dockerfiles/build-sqlite3/ol/.dockerignore b/Dockerfiles/build-sqlite3/ol/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/Dockerfiles/build-sqlite3/ol/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/Dockerfiles/build-sqlite3/ol/Dockerfile b/Dockerfiles/build-sqlite3/ol/Dockerfile new file mode 100644 index 000000000..797f9976c --- /dev/null +++ b/Dockerfiles/build-sqlite3/ol/Dockerfile @@ -0,0 +1,58 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-base:ol-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +LABEL org.opencontainers.image.title="Zabbix build base (SQLite3)" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base for SQLite3 based images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +RUN set -eux && \ + cd /tmp/ && \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch /tmp/zabbix-${ZBX_VERSION} && \ + cd /tmp/zabbix-${ZBX_VERSION} && \ + zabbix_revision=`git rev-parse --short HEAD` && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/go/pkg/version/version.go && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \ + ./bootstrap.sh && \ + export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ + ./configure \ + --datadir=/usr/lib \ + --libdir=/usr/lib/zabbix \ + --prefix=/usr \ + --sysconfdir=/etc/zabbix \ + --enable-agent \ + --enable-agent2 \ + --enable-proxy \ + --with-sqlite3 \ + --with-ldap \ + --with-libcurl \ + --with-libxml2 \ + --enable-java \ + --with-net-snmp \ + --with-openipmi \ + --with-openssl \ + --with-ssh \ + --with-unixodbc \ + --enable-ipv6 \ + --silent && \ + make -j"$(nproc)" -s dbschema && \ + make -j"$(nproc)" -s && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender \ No newline at end of file diff --git a/Dockerfiles/build-sqlite3/ol/build.sh b/Dockerfiles/build-sqlite3/ol/build.sh new file mode 120000 index 000000000..46b203134 --- /dev/null +++ b/Dockerfiles/build-sqlite3/ol/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/Dockerfiles/build-sqlite3/ubuntu/.dockerignore b/Dockerfiles/build-sqlite3/ubuntu/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/Dockerfiles/build-sqlite3/ubuntu/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/Dockerfiles/build-sqlite3/ubuntu/Dockerfile b/Dockerfiles/build-sqlite3/ubuntu/Dockerfile new file mode 100644 index 000000000..14f2ff7c0 --- /dev/null +++ b/Dockerfiles/build-sqlite3/ubuntu/Dockerfile @@ -0,0 +1,58 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-base:ubuntu-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" \ + org.opencontainers.image.title="Zabbix build base (SQLite3)" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base for SQLite3 based images" \ + org.opencontainers.image.licenses="GPL v2.0" + +RUN set -eux && \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch /tmp/zabbix-${ZBX_VERSION} && \ + ls -lah /tmp/ && \ + cd /tmp/zabbix-${ZBX_VERSION} && \ + zabbix_revision=`git rev-parse --short HEAD` && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/go/pkg/version/version.go && \ + sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \ + ./bootstrap.sh && \ + export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ + ./configure \ + --datadir=/usr/lib \ + --libdir=/usr/lib/zabbix \ + --prefix=/usr \ + --sysconfdir=/etc/zabbix \ + --enable-agent \ + --enable-agent2 \ + --enable-proxy \ + --with-sqlite3 \ + --with-ldap \ + --with-libcurl \ + --with-libxml2 \ + --enable-java \ + --with-net-snmp \ + --with-openipmi \ + --with-openssl \ + --with-ssh \ + --with-unixodbc \ + --enable-ipv6 \ + --silent && \ + make -j"$(nproc)" -s dbschema && \ + make -j"$(nproc)" -s && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender \ No newline at end of file diff --git a/Dockerfiles/build-sqlite3/ubuntu/build.sh b/Dockerfiles/build-sqlite3/ubuntu/build.sh new file mode 120000 index 000000000..46b203134 --- /dev/null +++ b/Dockerfiles/build-sqlite3/ubuntu/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/Dockerfiles/build-sqlite3/ubuntu/docker-entrypoint.sh b/Dockerfiles/build-sqlite3/ubuntu/docker-entrypoint.sh new file mode 100755 index 000000000..046c284ce --- /dev/null +++ b/Dockerfiles/build-sqlite3/ubuntu/docker-entrypoint.sh @@ -0,0 +1,487 @@ +#!/bin/bash + +set -o pipefail + +set +e + +# Script trace mode +if [ "${DEBUG_MODE,,}" == "true" ]; then + set -o xtrace +fi + +# Default directories +# User 'zabbix' home directory +ZABBIX_USER_HOME_DIR="/var/lib/zabbix" +# Configuration files directory +ZABBIX_ETC_DIR="/etc/zabbix" + +# usage: file_env VAR [DEFAULT] +# as example: file_env 'MYSQL_PASSWORD' 'zabbix' +# (will allow for "$MYSQL_PASSWORD_FILE" to fill in the value of "$MYSQL_PASSWORD" from a file) +# unsets the VAR_FILE afterwards and just leaving VAR +file_env() { + local var="$1" + local fileVar="${var}_FILE" + local defaultValue="${2:-}" + + if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then + echo "**** Both variables $var and $fileVar are set (but are exclusive)" + exit 1 + fi + + local val="$defaultValue" + + if [ "${!var:-}" ]; then + val="${!var}" + echo "** Using ${var} variable from ENV" + elif [ "${!fileVar:-}" ]; then + if [ ! -f "${!fileVar}" ]; then + echo "**** Secret file \"${!fileVar}\" is not found" + exit 1 + fi + val="$(< "${!fileVar}")" + echo "** Using ${var} variable from secret file" + fi + export "$var"="$val" + unset "$fileVar" +} + +escape_spec_char() { + local var_value=$1 + + var_value="${var_value//\\/\\\\}" + var_value="${var_value//[$'\n']/}" + var_value="${var_value//\//\\/}" + var_value="${var_value//./\\.}" + var_value="${var_value//\*/\\*}" + var_value="${var_value//^/\\^}" + var_value="${var_value//\$/\\\$}" + var_value="${var_value//\&/\\\&}" + var_value="${var_value//\[/\\[}" + var_value="${var_value//\]/\\]}" + + echo "$var_value" +} + +update_config_var() { + local config_path=$1 + local var_name=$2 + local var_value=$3 + local is_multiple=$4 + + local masklist=("DBPassword TLSPSKIdentity") + + if [ ! -f "$config_path" ]; then + echo "**** Configuration file '$config_path' does not exist" + return + fi + + if [[ " ${masklist[@]} " =~ " $var_name " ]] && [ ! -z "$var_value" ]; then + echo -n "** Updating '$config_path' parameter \"$var_name\": '****'. Enable DEBUG_MODE to view value ..." + else + echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." + fi + + # Remove configuration parameter definition in case of unset parameter value + if [ -z "$var_value" ]; then + sed -i -e "/^$var_name=/d" "$config_path" + echo "removed" + return + fi + + # Remove value from configuration parameter in case of double quoted parameter value + if [ "$var_value" == '""' ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + echo "undefined" + return + fi + + # Use full path to a file for TLS related configuration parameters + if [[ $var_name =~ ^TLS.*File$ ]]; then + var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value + fi + + # Escaping characters in parameter value and name + var_value=$(escape_spec_char "$var_value") + var_name=$(escape_spec_char "$var_name") + + if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then + sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path" + echo "updated" + elif [ "$(grep -Ec "^# $var_name=" $config_path)" -gt 1 ]; then + sed -i -e "/^[#;] $var_name=$/i\\$var_name=$var_value" "$config_path" + echo "added first occurrence" + else + sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=$var_value/" "$config_path" + echo "added" + fi + +} + +update_config_multiple_var() { + local config_path=$1 + local var_name=$2 + local var_value=$3 + + var_value="${var_value%\"}" + var_value="${var_value#\"}" + + local IFS=, + local OPT_LIST=($var_value) + + for value in "${OPT_LIST[@]}"; do + update_config_var $config_path $var_name $value true + done +} + +# Check prerequisites for MySQL database +check_variables_mysql() { + : ${DB_SERVER_HOST:="mysql-server"} + : ${DB_SERVER_PORT:="3306"} + USE_DB_ROOT_USER=false + CREATE_ZBX_DB_USER=false + file_env MYSQL_USER + file_env MYSQL_PASSWORD + + file_env MYSQL_ROOT_PASSWORD + + if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then + echo "**** Impossible to use MySQL server because of unknown Zabbix user and random 'root' password" + exit 1 + fi + + if [ ! -n "${MYSQL_USER}" ] && [ ! -n "${MYSQL_ROOT_PASSWORD}" ] && [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" != "true" ]; then + echo "*** Impossible to use MySQL server because 'root' password is not defined and it is not empty" + exit 1 + fi + + if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then + USE_DB_ROOT_USER=true + DB_SERVER_ROOT_USER="root" + DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""} + fi + + [ -n "${MYSQL_USER}" ] && [ "${USE_DB_ROOT_USER}" == "true" ] && CREATE_ZBX_DB_USER=true + + # If root password is not specified use provided credentials + : ${DB_SERVER_ROOT_USER:=${MYSQL_USER}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} + DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} + + DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix"} +} + +db_tls_params() { + local result="" + + if [ -n "${ZBX_DBTLSCONNECT}" ]; then + ssl_mode=${ZBX_DBTLSCONNECT//verify_full/verify_identity} + result="--ssl-mode=$ssl_mode" + + if [ -n "${ZBX_DBTLSCAFILE}" ]; then + result="${result} --ssl-ca=${ZBX_DBTLSCAFILE}" + fi + + if [ -n "${ZBX_DBTLSKEYFILE}" ]; then + result="${result} --ssl-key=${ZBX_DBTLSKEYFILE}" + fi + + if [ -n "${ZBX_DBTLSCERTFILE}" ]; then + result="${result} --ssl-cert=${ZBX_DBTLSCERTFILE}" + fi + fi + + echo $result +} + +check_db_connect_mysql() { + echo "********************" + echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}" + echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}" + echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}" + if [ "${DEBUG_MODE,,}" == "true" ]; then + if [ "${USE_DB_ROOT_USER}" == "true" ]; then + echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}" + echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}" + fi + echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}" + echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}" + fi + echo "********************" + + WAIT_TIMEOUT=5 + + ssl_opts="$(db_tls_params)" + + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + + while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \ + --silent --connect_timeout=10 $ssl_opts)" ]; do + echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..." + sleep $WAIT_TIMEOUT + done + + unset MYSQL_PWD +} + +mysql_query() { + query=$1 + local result="" + + ssl_opts="$(db_tls_params)" + + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + + result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ + -u ${DB_SERVER_ROOT_USER} -e "$query" $ssl_opts) + + unset MYSQL_PWD + + echo $result +} + +create_db_user_mysql() { + [ "${CREATE_ZBX_DB_USER}" == "true" ] || return + + echo "** Creating '${DB_SERVER_ZBX_USER}' user in MySQL database" + + USER_EXISTS=$(mysql_query "SELECT 1 FROM mysql.user WHERE user = '${DB_SERVER_ZBX_USER}' AND host = '%'") + + if [ -z "$USER_EXISTS" ]; then + mysql_query "CREATE USER '${DB_SERVER_ZBX_USER}'@'%' IDENTIFIED BY '${DB_SERVER_ZBX_PASS}'" 1>/dev/null + else + mysql_query "ALTER USER ${DB_SERVER_ZBX_USER} IDENTIFIED BY '${DB_SERVER_ZBX_PASS}';" 1>/dev/null + fi + + mysql_query "GRANT ALL PRIVILEGES ON $DB_SERVER_DBNAME. * TO '${DB_SERVER_ZBX_USER}'@'%'" 1>/dev/null +} + +create_db_database_mysql() { + DB_EXISTS=$(mysql_query "SELECT SCHEMA_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME='${DB_SERVER_DBNAME}'") + + if [ -z ${DB_EXISTS} ]; then + echo "** Database '${DB_SERVER_DBNAME}' does not exist. Creating..." + mysql_query "CREATE DATABASE ${DB_SERVER_DBNAME} CHARACTER SET utf8 COLLATE utf8_bin" 1>/dev/null + # better solution? + mysql_query "GRANT ALL PRIVILEGES ON $DB_SERVER_DBNAME. * TO '${DB_SERVER_ZBX_USER}'@'%'" 1>/dev/null + else + echo "** Database '${DB_SERVER_DBNAME}' already exists. Please be careful with database COLLATE!" + fi +} + +create_db_schema_mysql() { + DBVERSION_TABLE_EXISTS=$(mysql_query "SELECT 1 FROM information_schema.tables WHERE table_schema='${DB_SERVER_DBNAME}' and table_name = 'dbversion'") + + if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then + echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." + ZBX_DB_VERSION=$(mysql_query "SELECT mandatory FROM ${DB_SERVER_DBNAME}.dbversion") + fi + + if [ -z "${ZBX_DB_VERSION}" ]; then + echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" + + ssl_opts="$(db_tls_params)" + + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + + zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql --silent --skip-column-names \ + -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ + -u ${DB_SERVER_ROOT_USER} $ssl_opts \ + ${DB_SERVER_DBNAME} 1>/dev/null + + unset MYSQL_PWD + fi +} + +update_zbx_config() { + echo "** Preparing Zabbix server configuration file" + + ZBX_CONFIG=$ZABBIX_ETC_DIR/zabbix_server.conf + + update_config_var $ZBX_CONFIG "ListenIP" "${ZBX_LISTENIP}" + update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}" + + update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}" + update_config_var $ZBX_CONFIG "LogType" "console" + update_config_var $ZBX_CONFIG "LogFile" + update_config_var $ZBX_CONFIG "LogFileSize" + update_config_var $ZBX_CONFIG "PidFile" + + update_config_var $ZBX_CONFIG "DebugLevel" "${ZBX_DEBUGLEVEL}" + + if [ -n "${ZBX_DBTLSCONNECT}" ]; then + update_config_var $ZBX_CONFIG "DBTLSConnect" "${ZBX_DBTLSCONNECT}" + update_config_var $ZBX_CONFIG "DBTLSCAFile" "${ZBX_DBTLSCAFILE}" + update_config_var $ZBX_CONFIG "DBTLSCertFile" "${ZBX_DBTLSCERTFILE}" + update_config_var $ZBX_CONFIG "DBTLSKeyFile" "${ZBX_DBTLSKEYFILE}" + update_config_var $ZBX_CONFIG "DBTLSCipher" "${ZBX_DBTLSCIPHER}" + update_config_var $ZBX_CONFIG "DBTLSCipher13" "${ZBX_DBTLSCIPHER13}" + fi + + update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}" + update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}" + update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}" + update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}" + + if [ -n "${VAULT_TOKEN}" ]; then + update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}" + update_config_var $ZBX_CONFIG "VaultURL" "${ZBX_VAULTURL}" + update_config_var $ZBX_CONFIG "DBUser" + update_config_var $ZBX_CONFIG "DBPassword" + else + update_config_var $ZBX_CONFIG "VaultDBPath" + update_config_var $ZBX_CONFIG "VaultURL" + update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}" + update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}" + fi + + update_config_var $ZBX_CONFIG "StartReportWriters" "${ZBX_STARTREPORTWRITERS}" + : ${ZBX_WEBSERVICEURL:="http://zabbix-web-service:10053/report"} + update_config_var $ZBX_CONFIG "WebServiceURL" "${ZBX_WEBSERVICEURL}" + + update_config_var $ZBX_CONFIG "HistoryStorageURL" "${ZBX_HISTORYSTORAGEURL}" + update_config_var $ZBX_CONFIG "HistoryStorageTypes" "${ZBX_HISTORYSTORAGETYPES}" + update_config_var $ZBX_CONFIG "HistoryStorageDateIndex" "${ZBX_HISTORYSTORAGEDATEINDEX}" + + update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}" + + update_config_var $ZBX_CONFIG "StatsAllowedIP" "${ZBX_STATSALLOWEDIP}" + + update_config_var $ZBX_CONFIG "StartPollers" "${ZBX_STARTPOLLERS}" + update_config_var $ZBX_CONFIG "StartIPMIPollers" "${ZBX_IPMIPOLLERS}" + update_config_var $ZBX_CONFIG "StartPollersUnreachable" "${ZBX_STARTPOLLERSUNREACHABLE}" + update_config_var $ZBX_CONFIG "StartTrappers" "${ZBX_STARTTRAPPERS}" + update_config_var $ZBX_CONFIG "StartPingers" "${ZBX_STARTPINGERS}" + update_config_var $ZBX_CONFIG "StartDiscoverers" "${ZBX_STARTDISCOVERERS}" + update_config_var $ZBX_CONFIG "StartHistoryPollers" "${ZBX_STARTHISTORYPOLLERS}" + update_config_var $ZBX_CONFIG "StartHTTPPollers" "${ZBX_STARTHTTPPOLLERS}" + + update_config_var $ZBX_CONFIG "StartPreprocessors" "${ZBX_STARTPREPROCESSORS}" + update_config_var $ZBX_CONFIG "StartTimers" "${ZBX_STARTTIMERS}" + update_config_var $ZBX_CONFIG "StartEscalators" "${ZBX_STARTESCALATORS}" + update_config_var $ZBX_CONFIG "StartAlerters" "${ZBX_STARTALERTERS}" + update_config_var $ZBX_CONFIG "StartTimers" "${ZBX_STARTTIMERS}" + update_config_var $ZBX_CONFIG "StartEscalators" "${ZBX_STARTESCALATORS}" + + update_config_var $ZBX_CONFIG "StartLLDProcessors" "${ZBX_STARTLLDPROCESSORS}" + + : ${ZBX_JAVAGATEWAY_ENABLE:="false"} + if [ "${ZBX_JAVAGATEWAY_ENABLE,,}" == "true" ]; then + update_config_var $ZBX_CONFIG "JavaGateway" "${ZBX_JAVAGATEWAY:-"zabbix-java-gateway"}" + update_config_var $ZBX_CONFIG "JavaGatewayPort" "${ZBX_JAVAGATEWAYPORT}" + update_config_var $ZBX_CONFIG "StartJavaPollers" "${ZBX_STARTJAVAPOLLERS:-"5"}" + else + update_config_var $ZBX_CONFIG "JavaGateway" + update_config_var $ZBX_CONFIG "JavaGatewayPort" + update_config_var $ZBX_CONFIG "StartJavaPollers" + fi + + update_config_var $ZBX_CONFIG "StartVMwareCollectors" "${ZBX_STARTVMWARECOLLECTORS}" + update_config_var $ZBX_CONFIG "VMwareFrequency" "${ZBX_VMWAREFREQUENCY}" + update_config_var $ZBX_CONFIG "VMwarePerfFrequency" "${ZBX_VMWAREPERFFREQUENCY}" + update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" + update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + + : ${ZBX_ENABLE_SNMP_TRAPS:="false"} + if [ "${ZBX_ENABLE_SNMP_TRAPS,,}" == "true" ]; then + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" + update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" + else + update_config_var $ZBX_CONFIG "SNMPTrapperFile" + update_config_var $ZBX_CONFIG "StartSNMPTrapper" + fi + + update_config_var $ZBX_CONFIG "HousekeepingFrequency" "${ZBX_HOUSEKEEPINGFREQUENCY}" + update_config_var $ZBX_CONFIG "MaxHousekeeperDelete" "${ZBX_MAXHOUSEKEEPERDELETE}" + update_config_var $ZBX_CONFIG "SenderFrequency" "${ZBX_SENDERFREQUENCY}" + + update_config_var $ZBX_CONFIG "CacheSize" "${ZBX_CACHESIZE}" + + update_config_var $ZBX_CONFIG "CacheUpdateFrequency" "${ZBX_CACHEUPDATEFREQUENCY}" + + update_config_var $ZBX_CONFIG "StartDBSyncers" "${ZBX_STARTDBSYNCERS}" + update_config_var $ZBX_CONFIG "HistoryCacheSize" "${ZBX_HISTORYCACHESIZE}" + update_config_var $ZBX_CONFIG "HistoryIndexCacheSize" "${ZBX_HISTORYINDEXCACHESIZE}" + + update_config_var $ZBX_CONFIG "TrendCacheSize" "${ZBX_TRENDCACHESIZE}" + update_config_var $ZBX_CONFIG "ValueCacheSize" "${ZBX_VALUECACHESIZE}" + + update_config_var $ZBX_CONFIG "Timeout" "${ZBX_TIMEOUT}" + update_config_var $ZBX_CONFIG "TrapperTimeout" "${ZBX_TRAPPERTIMEOUT}" + update_config_var $ZBX_CONFIG "UnreachablePeriod" "${ZBX_UNREACHABLEPERIOD}" + update_config_var $ZBX_CONFIG "UnavailableDelay" "${ZBX_UNAVAILABLEDELAY}" + update_config_var $ZBX_CONFIG "UnreachableDelay" "${ZBX_UNREACHABLEDELAY}" + + update_config_var $ZBX_CONFIG "AlertScriptsPath" "/usr/lib/zabbix/alertscripts" + update_config_var $ZBX_CONFIG "ExternalScripts" "/usr/lib/zabbix/externalscripts" + + if [ -n "${ZBX_EXPORTFILESIZE}" ]; then + update_config_var $ZBX_CONFIG "ExportDir" "$ZABBIX_USER_HOME_DIR/export/" + update_config_var $ZBX_CONFIG "ExportFileSize" "${ZBX_EXPORTFILESIZE}" + update_config_var $ZBX_CONFIG "ExportType" "${ZBX_EXPORTTYPE}" + fi + + update_config_var $ZBX_CONFIG "FpingLocation" "/usr/bin/fping" + update_config_var $ZBX_CONFIG "Fping6Location" "/usr/bin/fping6" + + update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" + update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" + + update_config_var $ZBX_CONFIG "StartProxyPollers" "${ZBX_STARTPROXYPOLLERS}" + update_config_var $ZBX_CONFIG "ProxyConfigFrequency" "${ZBX_PROXYCONFIGFREQUENCY}" + update_config_var $ZBX_CONFIG "ProxyDataFrequency" "${ZBX_PROXYDATAFREQUENCY}" + + update_config_var $ZBX_CONFIG "SSLCertLocation" "$ZABBIX_USER_HOME_DIR/ssl/certs/" + update_config_var $ZBX_CONFIG "SSLKeyLocation" "$ZABBIX_USER_HOME_DIR/ssl/keys/" + update_config_var $ZBX_CONFIG "SSLCALocation" "$ZABBIX_USER_HOME_DIR/ssl/ssl_ca/" + update_config_var $ZBX_CONFIG "LoadModulePath" "$ZABBIX_USER_HOME_DIR/modules/" + update_config_multiple_var $ZBX_CONFIG "LoadModule" "${ZBX_LOADMODULE}" + + update_config_var $ZBX_CONFIG "TLSCAFile" "${ZBX_TLSCAFILE}" + update_config_var $ZBX_CONFIG "TLSCRLFile" "${ZBX_TLSCRLFILE}" + + update_config_var $ZBX_CONFIG "TLSCertFile" "${ZBX_TLSCERTFILE}" + update_config_var $ZBX_CONFIG "TLSCipherAll" "${ZBX_TLSCIPHERALL}" + update_config_var $ZBX_CONFIG "TLSCipherAll13" "${ZBX_TLSCIPHERALL13}" + update_config_var $ZBX_CONFIG "TLSCipherCert" "${ZBX_TLSCIPHERCERT}" + update_config_var $ZBX_CONFIG "TLSCipherCert13" "${ZBX_TLSCIPHERCERT13}" + update_config_var $ZBX_CONFIG "TLSCipherPSK" "${ZBX_TLSCIPHERPSK}" + update_config_var $ZBX_CONFIG "TLSCipherPSK13" "${ZBX_TLSCIPHERPSK13}" + update_config_var $ZBX_CONFIG "TLSKeyFile" "${ZBX_TLSKEYFILE}" + + update_config_var $ZBX_CONFIG "TLSPSKIdentity" "${ZBX_TLSPSKIDENTITY}" + update_config_var $ZBX_CONFIG "TLSPSKFile" "${ZBX_TLSPSKFILE}" + + if [ "$(id -u)" != '0' ]; then + update_config_var $ZBX_CONFIG "User" "$(whoami)" + else + update_config_var $ZBX_CONFIG "AllowRoot" "1" + fi +} + +prepare_server() { + echo "** Preparing Zabbix server" + + check_variables_mysql + check_db_connect_mysql + create_db_user_mysql + create_db_database_mysql + create_db_schema_mysql + + update_zbx_config +} + +################################################# + +if [ "${1#-}" != "$1" ]; then + set -- /usr/sbin/zabbix_server "$@" + fi + +if [ "$1" == '/usr/sbin/zabbix_server' ]; then + prepare_server +fi + +exec "$@" + +################################################# diff --git a/Dockerfiles/java-gateway/alpine/Dockerfile b/Dockerfiles/java-gateway/alpine/Dockerfile index 2f2004ef6..0716e5b47 100644 --- a/Dockerfiles/java-gateway/alpine/Dockerfile +++ b/Dockerfiles/java-gateway/alpine/Dockerfile @@ -1,14 +1,35 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:alpine-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM alpine:3.12 +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + PATH=${PATH}:/usr/lib/jvm/default-jvm/bin/ JAVA_HOME=/usr/lib/jvm/default-jvm + LABEL org.opencontainers.image.title="Zabbix Java Gateway" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix Java Gateway performs native support for monitoring JMX applications" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_java/bin", "/usr/sbin/zabbix_java/bin"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_java/lib", "/usr/sbin/zabbix_java/lib"] + RUN set -eux && \ addgroup --system --gid 1995 zabbix && \ adduser --system \ @@ -26,56 +47,11 @@ RUN set -eux && \ apk add --clean-protected --no-cache \ bash \ openjdk8-jre-base && \ - rm -rf /var/cache/apk/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ - PATH=${PATH}:/usr/lib/jvm/default-jvm/bin/ JAVA_HOME=/usr/lib/jvm/default-jvm - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - apk add --no-cache --virtual build-dependencies \ - autoconf \ - automake \ - coreutils \ - pkgconf \ - git \ - g++ \ - make \ - openjdk8 && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \ - ./bootstrap.sh && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-java \ - --silent && \ - make -j"$(nproc)" -s && \ - mkdir -p /usr/sbin/zabbix_java/ && \ - cp -r src/zabbix_java/bin /usr/sbin/zabbix_java/ && \ - cp -r src/zabbix_java/lib /usr/sbin/zabbix_java/ && \ rm -rf /usr/sbin/zabbix_java/lib/logback.xml && \ mv /usr/sbin/zabbix_java/lib/logback-console.xml /etc/zabbix/zabbix_java_gateway_logback.xml && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ chown --quiet -R zabbix:root /etc/zabbix/ /usr/sbin/zabbix_java/ && \ chgrp -R 0 /etc/zabbix/ /usr/sbin/zabbix_java/ && \ chmod -R g=u /etc/zabbix/ /usr/sbin/zabbix_java/ && \ - apk del --purge --no-network \ - build-dependencies && \ rm -rf /var/cache/apk/* EXPOSE 10052/TCP diff --git a/Dockerfiles/java-gateway/centos/Dockerfile b/Dockerfiles/java-gateway/centos/Dockerfile index 7e6b41490..edeff8e90 100644 --- a/Dockerfiles/java-gateway/centos/Dockerfile +++ b/Dockerfiles/java-gateway/centos/Dockerfile @@ -1,14 +1,34 @@ -FROM centos:centos8 +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:centos-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + +FROM centos:8 + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} LABEL org.opencontainers.image.title="Zabbix Java Gateway" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix Java Gateway performs native support for monitoring JMX applications" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_java/bin", "/usr/sbin/zabbix_java/bin"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_java/lib", "/usr/sbin/zabbix_java/lib"] + RUN set -eux && \ groupadd --system --gid 1995 zabbix && \ useradd \ @@ -21,59 +41,22 @@ RUN set -eux && \ mkdir -p /etc/zabbix/ && \ mkdir -p /usr/sbin/zabbix_java/ && \ mkdir -p /usr/sbin/zabbix_java/ext_lib/ && \ - dnf --quiet makecache && \ - dnf -y install --setopt=tsflags=nodocs --setopt=install_weak_deps=False --best \ - java-1.8.0-openjdk-headless && \ - dnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - dnf --quiet makecache && \ - dnf -y install --setopt=tsflags=nodocs --setopt=install_weak_deps=False --best \ - autoconf \ - automake \ - java-1.8.0-openjdk-devel \ - make \ - git \ - gcc && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \ - ./bootstrap.sh && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-java \ - --silent && \ - make -j"$(nproc)" -s && \ - mkdir -p /usr/sbin/zabbix_java/ && \ - cp -r src/zabbix_java/bin /usr/sbin/zabbix_java/ && \ - cp -r src/zabbix_java/lib /usr/sbin/zabbix_java/ && \ + REPOLIST="baseos,appstream" && \ + INSTALL_PKGS="java-1.8.0-openjdk-headless \ + findutils" && \ + dnf -y install \ + --disablerepo "*" \ + --enablerepo "${REPOLIST}" \ + --setopt=tsflags=nodocs \ + --setopt=install_weak_deps=False \ + --best \ + ${INSTALL_PKGS} && \ rm -rf /usr/sbin/zabbix_java/lib/logback.xml && \ mv /usr/sbin/zabbix_java/lib/logback-console.xml /etc/zabbix/zabbix_java_gateway_logback.xml && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ - dnf -y history undo `dnf -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ - dnf -y clean all && \ chown --quiet -R zabbix:root /etc/zabbix/ /usr/sbin/zabbix_java/ && \ chgrp -R 0 /etc/zabbix/ /usr/sbin/zabbix_java/ && \ chmod -R g=u /etc/zabbix/ /usr/sbin/zabbix_java/ && \ + dnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/java-gateway/ol/Dockerfile b/Dockerfiles/java-gateway/ol/Dockerfile index 19b7a776c..f713ee1a5 100644 --- a/Dockerfiles/java-gateway/ol/Dockerfile +++ b/Dockerfiles/java-gateway/ol/Dockerfile @@ -1,14 +1,34 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix Java Gateway" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix Java Gateway performs native support for monitoring JMX applications" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_java/bin", "/usr/sbin/zabbix_java/bin"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_java/lib", "/usr/sbin/zabbix_java/lib"] + RUN set -eux && \ groupadd --system --gid 1995 zabbix && \ useradd \ @@ -23,62 +43,19 @@ RUN set -eux && \ mkdir -p /usr/sbin/zabbix_java/ext_lib/ && \ INSTALL_PKGS="java-1.8.0-openjdk-headless \ findutils" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ - microdnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && REPOLIST="ol8_baseos_latest,ol8_appstream" && \ - INSTALL_PKGS="autoconf \ - automake \ - java-1.8.0-openjdk-devel \ - make \ - git \ - gcc" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \ - ./bootstrap.sh && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-java \ - --silent && \ - make -j"$(nproc)" -s && \ - mkdir -p /usr/sbin/zabbix_java/ && \ - cp -r src/zabbix_java/bin /usr/sbin/zabbix_java/ && \ - cp -r src/zabbix_java/lib /usr/sbin/zabbix_java/ && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ rm -rf /usr/sbin/zabbix_java/lib/logback.xml && \ mv /usr/sbin/zabbix_java/lib/logback-console.xml /etc/zabbix/zabbix_java_gateway_logback.xml && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ chown --quiet -R zabbix:root /etc/zabbix/ /usr/sbin/zabbix_java/ && \ chgrp -R 0 /etc/zabbix/ /usr/sbin/zabbix_java/ && \ chmod -R g=u /etc/zabbix/ /usr/sbin/zabbix_java/ && \ + microdnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/java-gateway/ol/README.md b/Dockerfiles/java-gateway/ol/README.md index 7897ada12..66b6e0d1e 100644 --- a/Dockerfiles/java-gateway/ol/README.md +++ b/Dockerfiles/java-gateway/ol/README.md @@ -112,7 +112,7 @@ To minimize image size, it's uncommon for additional related tools (such as `git This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of. -## `zabbix-agent:ol-` +## `zabbix-java-gateway:ol-` Oracle Linux is an open-source operating system available under the GNU General Public License (GPLv2). Suitable for general purpose or Oracle workloads, it benefits from rigorous testing of more than 128,000 hours per day with real-world workloads and includes unique innovations such as Ksplice diff --git a/Dockerfiles/java-gateway/ol/docker-entrypoint.sh b/Dockerfiles/java-gateway/ol/docker-entrypoint.sh index 01ac14cd1..c2bea7442 100755 --- a/Dockerfiles/java-gateway/ol/docker-entrypoint.sh +++ b/Dockerfiles/java-gateway/ol/docker-entrypoint.sh @@ -18,14 +18,10 @@ prepare_java_gateway_config() { ZBX_GATEWAY_CONFIG=$ZABBIX_ETC_DIR/zabbix_java_gateway_logback.xml - if [ -n "${ZBX_DEBUGLEVEL}" ]; then - echo "Updating $ZBX_GATEWAY_CONFIG 'DebugLevel' parameter: '${ZBX_DEBUGLEVEL}'... updated" - if [ -f "$ZBX_GATEWAY_CONFIG" ]; then - sed -i -e "/^.*/" "$ZBX_GATEWAY_CONFIG" - else - echo "**** Zabbix Java Gateway log configuration file '$ZBX_GATEWAY_CONFIG' not found" - fi - fi + : ${ZBX_DEBUGLEVEL:="info"} + + echo "Updating $ZBX_GATEWAY_CONFIG 'DebugLevel' parameter: '${ZBX_DEBUGLEVEL}'... updated" + sed -i -e "/^.*/" "$ZBX_GATEWAY_CONFIG" } prepare_java_gateway() { diff --git a/Dockerfiles/java-gateway/rhel/Dockerfile b/Dockerfiles/java-gateway/rhel/Dockerfile index 9b902c684..3168b5298 100644 --- a/Dockerfiles/java-gateway/rhel/Dockerfile +++ b/Dockerfiles/java-gateway/rhel/Dockerfile @@ -60,8 +60,6 @@ RUN set -eux && INSTALL_PKGS="bash \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki -COPY ["conf/etc/", "/etc/"] - RUN set -eux && INSTALL_PKGS="autoconf \ automake \ pkgconf \ diff --git a/Dockerfiles/java-gateway/rhel/docker-entrypoint.sh b/Dockerfiles/java-gateway/rhel/docker-entrypoint.sh index 01ac14cd1..c2bea7442 100755 --- a/Dockerfiles/java-gateway/rhel/docker-entrypoint.sh +++ b/Dockerfiles/java-gateway/rhel/docker-entrypoint.sh @@ -18,14 +18,10 @@ prepare_java_gateway_config() { ZBX_GATEWAY_CONFIG=$ZABBIX_ETC_DIR/zabbix_java_gateway_logback.xml - if [ -n "${ZBX_DEBUGLEVEL}" ]; then - echo "Updating $ZBX_GATEWAY_CONFIG 'DebugLevel' parameter: '${ZBX_DEBUGLEVEL}'... updated" - if [ -f "$ZBX_GATEWAY_CONFIG" ]; then - sed -i -e "/^.*/" "$ZBX_GATEWAY_CONFIG" - else - echo "**** Zabbix Java Gateway log configuration file '$ZBX_GATEWAY_CONFIG' not found" - fi - fi + : ${ZBX_DEBUGLEVEL:="info"} + + echo "Updating $ZBX_GATEWAY_CONFIG 'DebugLevel' parameter: '${ZBX_DEBUGLEVEL}'... updated" + sed -i -e "/^.*/" "$ZBX_GATEWAY_CONFIG" } prepare_java_gateway() { diff --git a/Dockerfiles/java-gateway/ubuntu/Dockerfile b/Dockerfiles/java-gateway/ubuntu/Dockerfile index e6d4a517b..943493050 100644 --- a/Dockerfiles/java-gateway/ubuntu/Dockerfile +++ b/Dockerfiles/java-gateway/ubuntu/Dockerfile @@ -1,14 +1,34 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ubuntu-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM ubuntu:focal +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix Java Gateway" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix Java Gateway performs native support for monitoring JMX applications" \ - org.opencontainers.image.licenses="GPL v2.0" - + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_java/bin", "/usr/sbin/zabbix_java/bin"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_java/lib", "/usr/sbin/zabbix_java/lib"] + RUN set -eux && \ echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d && \ groupadd --system --gid 1995 zabbix && \ @@ -25,62 +45,8 @@ RUN set -eux && \ apt-get -y update && \ DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \ openjdk-8-jre-headless && \ - apt-get -y autoremove && \ - apt-get -y clean && \ - rm -rf /var/lib/apt/lists/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - apt-get -y update && \ - DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \ - autoconf \ - automake \ - libc6-dev \ - make \ - openjdk-8-jdk-headless \ - pkg-config \ - git \ - gcc && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \ - ./bootstrap.sh && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-java \ - --silent && \ - make -j"$(nproc)" -s && \ - mkdir -p /usr/sbin/zabbix_java/ && \ - cp -r src/zabbix_java/bin /usr/sbin/zabbix_java/ && \ - cp -r src/zabbix_java/lib /usr/sbin/zabbix_java/ && \ rm -rf /usr/sbin/zabbix_java/lib/logback.xml && \ mv /usr/sbin/zabbix_java/lib/logback-console.xml /etc/zabbix/zabbix_java_gateway_logback.xml && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ - DEBIAN_FRONTEND=noninteractive apt-get -y purge \ - autoconf \ - automake \ - libc6-dev \ - make \ - openjdk-8-jdk \ - pkg-config \ - git \ - gcc && \ apt-get -y autoremove && \ apt-get -y clean && \ chown --quiet -R zabbix:root /etc/zabbix/ /usr/sbin/zabbix_java/ && \ @@ -89,16 +55,16 @@ RUN set -eux && \ rm -rf /var/lib/apt/lists/* EXPOSE 10052/TCP - + WORKDIR /var/lib/zabbix VOLUME ["/usr/sbin/zabbix_java/ext_lib"] COPY ["conf/usr/sbin/zabbix_java_gateway", "/usr/sbin/"] COPY ["docker-entrypoint.sh", "/usr/bin/"] - + ENTRYPOINT ["docker-entrypoint.sh"] - + USER 1997 - + CMD ["/usr/sbin/zabbix_java_gateway"] diff --git a/Dockerfiles/proxy-mysql/alpine/Dockerfile b/Dockerfiles/proxy-mysql/alpine/Dockerfile index c48bd68bd..e3a3a5721 100644 --- a/Dockerfiles/proxy-mysql/alpine/Dockerfile +++ b/Dockerfiles/proxy-mysql/alpine/Dockerfile @@ -1,14 +1,38 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:alpine-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM alpine:3.12 +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + LABEL org.opencontainers.image.title="Zabbix proxy (MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix proxy with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy", "/usr/sbin/zabbix_proxy"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_proxy.conf", "/etc/zabbix/zabbix_proxy.conf"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/mysql/create_proxy.sql.gz", "/usr/share/doc/zabbix-proxy-mysql/create.sql.gz"] + RUN set -eux && \ addgroup --system --gid 1995 zabbix && \ adduser --system \ @@ -49,78 +73,9 @@ RUN set -eux && \ pcre \ unixodbc \ fping && \ - rm -rf /var/cache/apk/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ - MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - apk add --no-cache --virtual build-dependencies \ - autoconf \ - automake \ - coreutils \ - curl-dev \ - libevent-dev \ - g++ \ - git \ - make \ - libssh-dev \ - libxml2-dev \ - mysql-dev \ - net-snmp-dev \ - openipmi-dev \ - openldap-dev \ - pcre-dev \ - unixodbc-dev && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-agent \ - --enable-proxy \ - --with-mysql \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ - cat database/mysql/schema.sql > database/mysql/create.sql && \ - gzip database/mysql/create.sql && \ - cp database/mysql/create.sql.gz /usr/share/doc/zabbix-proxy-mysql/ && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - apk del --purge --no-network \ - build-dependencies && \ rm -rf /var/cache/apk/* EXPOSE 10051/TCP diff --git a/Dockerfiles/proxy-mysql/centos/Dockerfile b/Dockerfiles/proxy-mysql/centos/Dockerfile index e87638e36..3a78b5526 100644 --- a/Dockerfiles/proxy-mysql/centos/Dockerfile +++ b/Dockerfiles/proxy-mysql/centos/Dockerfile @@ -1,27 +1,40 @@ -FROM centos:centos8 +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:centos-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + +FROM centos:8 + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm \ + ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL LABEL org.opencontainers.image.title="Zabbix proxy (MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix proxy with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM -ENV TINI_VERSION=v0.19.0 +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy", "/usr/sbin/zabbix_proxy"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_proxy.conf", "/etc/zabbix/zabbix_proxy.conf"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/mysql/create_proxy.sql.gz", "/usr/share/doc/zabbix-proxy-mysql/create.sql.gz"] RUN set -eux && \ - ARCH_SUFFIX="$(arch)"; \ - case "$ARCH_SUFFIX" in \ - i686) export ARCH_SUFFIX='i386' ;; \ - x86_64) [ -f /lib64/ld-linux-x86-64.so.2 ] && export ARCH_SUFFIX='amd64' || export ARCH_SUFFIX='i386' ;; \ - aarch64) export ARCH_SUFFIX='arm64' ;; \ - armv7l) export ARCH_SUFFIX='armhf' ;; \ - ppc64el|ppc64le) export ARCH_SUFFIX='ppc64le' ;; \ - s390x) export ARCH_SUFFIX='s390x' ;; \ - *) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \ - esac; \ groupadd --system --gid 1995 zabbix && \ useradd \ --system --comment "Zabbix monitoring system" \ @@ -43,15 +56,14 @@ RUN set -eux && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /usr/lib/zabbix/externalscripts && \ mkdir -p /usr/share/doc/zabbix-proxy-mysql && \ - dnf --quiet makecache && \ - dnf -y install epel-release && \ dnf -y module enable mysql && \ - dnf -y install --setopt=tsflags=nodocs --setopt=install_weak_deps=False --best \ - libcurl-minimal \ - libevent \ + REPOLIST="baseos,appstream,epel" && \ + INSTALL_PKGS="libevent \ + tini \ + systemd \ libssh \ - fping \ file-libs \ + fping \ libxml2 \ mysql \ mysql-libs \ @@ -61,97 +73,19 @@ RUN set -eux && \ openssl-libs \ pcre \ zlib \ - unixODBC && \ - curl -L "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${ARCH_SUFFIX}" -o /sbin/tini && \ - curl -L "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${ARCH_SUFFIX}.asc" -o /tmp/tini.asc && \ - export GNUPGHOME="$(mktemp -d)" && \ - for server in $(shuf -e ha.pool.sks-keyservers.net \ - hkp://p80.pool.sks-keyservers.net:80 \ - ipv4.pool.sks-keyservers.net \ - keyserver.ubuntu.com \ - keyserver.pgp.com \ - pgp.mit.edu) ; do \ - gpg --keyserver "$server" --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 && break || : ; \ - done && \ - gpg --batch --verify /tmp/tini.asc /sbin/tini && \ - rm -rf "$GNUPGHOME" /tmp/tini.asc && \ - chmod +x /sbin/tini && \ - dnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/CentOS-Linux-PowerTools.repo && \ - dnf --quiet makecache && \ - dnf -y install --setopt=tsflags=nodocs --setopt=install_weak_deps=False --best \ - autoconf \ - automake \ - gcc \ - pcre-devel \ - libcurl-devel \ - libevent-devel \ - libssh-devel \ - libxml2-devel \ - make \ - mysql-devel \ - net-snmp-devel \ - OpenIPMI-devel \ - openldap-devel \ - git \ - unixODBC-devel && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-agent \ - --enable-proxy \ - --with-mysql \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ - cat database/mysql/schema.sql > database/mysql/create.sql && \ - gzip database/mysql/create.sql && \ - cp database/mysql/create.sql.gz /usr/share/doc/zabbix-proxy-mysql/ && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ + unixODBC" && \ + dnf -y install epel-release && \ + dnf -y install \ + --disablerepo "*" \ + --enablerepo "${REPOLIST}" \ + --setopt=tsflags=nodocs \ + --setopt=install_weak_deps=False \ + --best \ + ${INSTALL_PKGS} && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - dnf -y history undo `dnf -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ dnf -y clean all && \ - sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/CentOS-Linux-PowerTools.repo && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki @@ -163,7 +97,7 @@ VOLUME ["/var/lib/zabbix/snmptraps"] COPY ["docker-entrypoint.sh", "/usr/bin/"] -ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/docker-entrypoint.sh"] +ENTRYPOINT ["/usr/bin/tini", "--", "/usr/bin/docker-entrypoint.sh"] USER 1997 diff --git a/Dockerfiles/proxy-mysql/ol/Dockerfile b/Dockerfiles/proxy-mysql/ol/Dockerfile index 9ab337bd6..86d803ef7 100644 --- a/Dockerfiles/proxy-mysql/ol/Dockerfile +++ b/Dockerfiles/proxy-mysql/ol/Dockerfile @@ -1,14 +1,38 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm \ + ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + LABEL org.opencontainers.image.title="Zabbix proxy (MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix proxy with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy", "/usr/sbin/zabbix_proxy"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_proxy.conf", "/etc/zabbix/zabbix_proxy.conf"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/mysql/create_proxy.sql.gz", "/usr/share/doc/zabbix-proxy-mysql/create.sql.gz"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -50,88 +74,18 @@ RUN set -eux && \ pcre \ zlib \ unixODBC" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ - microdnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - REPOLIST="ol8_baseos_latest,ol8_appstream,ol8_codeready_builder" && \ - INSTALL_PKGS="autoconf \ - automake \ - gcc \ - pcre-devel \ - libcurl-devel \ - libevent-devel \ - libssh-devel \ - libxml2-devel \ - make \ - mysql-devel \ - net-snmp-devel \ - OpenIPMI-devel \ - openldap-devel \ - git \ - unixODBC-devel" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-agent \ - --enable-proxy \ - --with-mysql \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ - cat database/mysql/schema.sql > database/mysql/create.sql && \ - gzip database/mysql/create.sql && \ - cp database/mysql/create.sql.gz /usr/share/doc/zabbix-proxy-mysql/ && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + microdnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/proxy-mysql/ol/README.md b/Dockerfiles/proxy-mysql/ol/README.md index 504babf37..d3051b713 100644 --- a/Dockerfiles/proxy-mysql/ol/README.md +++ b/Dockerfiles/proxy-mysql/ol/README.md @@ -290,7 +290,7 @@ To minimize image size, it's uncommon for additional related tools (such as `git This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of. -## `zabbix-agent:ol-` +## `zabbix-proxy-mysql:ol-` Oracle Linux is an open-source operating system available under the GNU General Public License (GPLv2). Suitable for general purpose or Oracle workloads, it benefits from rigorous testing of more than 128,000 hours per day with real-world workloads and includes unique innovations such as Ksplice for zero-downtime kernel patching, DTrace for real-time diagnostics, the powerful Btrfs file system, and more. diff --git a/Dockerfiles/proxy-mysql/ubuntu/Dockerfile b/Dockerfiles/proxy-mysql/ubuntu/Dockerfile index 32de65f47..96eb15d31 100644 --- a/Dockerfiles/proxy-mysql/ubuntu/Dockerfile +++ b/Dockerfiles/proxy-mysql/ubuntu/Dockerfile @@ -1,25 +1,40 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ubuntu-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM ubuntu:focal +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm \ + ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + LABEL org.opencontainers.image.title="Zabbix proxy (MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix proxy with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy", "/usr/sbin/zabbix_proxy"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_proxy.conf", "/etc/zabbix/zabbix_proxy.conf"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/mysql/create_proxy.sql.gz", "/usr/share/doc/zabbix-proxy-mysql/create.sql.gz"] + RUN set -eux && \ - ARCH_SUFFIX="$(arch)"; \ - case "$ARCH_SUFFIX" in \ - i686) export ARCH_SUFFIX='i386' ;; \ - x86_64) [ -f /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ] && export ARCH_SUFFIX='amd64' || export ARCH_SUFFIX='i386' ;; \ - aarch64) export ARCH_SUFFIX='arm64' ;; \ - armv7l) export ARCH_SUFFIX='armhf' ;; \ - ppc64el|ppc64le) export ARCH_SUFFIX='ppc64le' ;; \ - s390x) export ARCH_SUFFIX='s390x' ;; \ - *) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \ - esac; \ echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d && \ groupadd --system --gid 1995 zabbix && \ useradd \ @@ -59,99 +74,11 @@ RUN set -eux && \ mysql-client \ snmp-mibs-downloader \ unixodbc && \ - apt-get -y autoremove && \ - apt-get -y clean && \ - rm -rf /var/lib/apt/lists/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - apt-get -y update && \ - DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \ - autoconf \ - automake \ - gcc \ - libc6-dev \ - libcurl4-openssl-dev \ - libevent-dev \ - libldap2-dev \ - libmysqlclient-dev \ - libopenipmi-dev \ - libpcre3-dev \ - libsnmp-dev \ - libssh-dev \ - libxml2-dev \ - make \ - pkg-config \ - git \ - unixodbc-dev && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-agent \ - --enable-proxy \ - --with-mysql \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ - cat database/mysql/schema.sql > database/mysql/create.sql && \ - gzip database/mysql/create.sql && \ - cp database/mysql/create.sql.gz /usr/share/doc/zabbix-proxy-mysql/ && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - DEBIAN_FRONTEND=noninteractive apt-get -y purge \ - autoconf \ - automake \ - gcc \ - libc6-dev \ - libcurl4-openssl-dev \ - libevent-dev \ - libldap2-dev \ - libmysqlclient-dev \ - libopenipmi-dev \ - libpcre3-dev \ - libsnmp-dev \ - libssh-dev \ - libxml2-dev \ - make \ - pkg-config \ - git \ - unixodbc-dev && \ apt-get -y autoremove && \ + apt-get -y clean && \ rm -rf /var/lib/apt/lists/* EXPOSE 10051/TCP diff --git a/Dockerfiles/proxy-sqlite3/alpine/Dockerfile b/Dockerfiles/proxy-sqlite3/alpine/Dockerfile index be7cf6da3..ae827f1b1 100644 --- a/Dockerfiles/proxy-sqlite3/alpine/Dockerfile +++ b/Dockerfiles/proxy-sqlite3/alpine/Dockerfile @@ -1,14 +1,36 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-sqlite3:alpine-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + FROM alpine:3.12 +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + LABEL org.opencontainers.image.title="Zabbix proxy (SQLite3)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix proxy with SQLite3 database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy", "/usr/sbin/zabbix_proxy"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_proxy.conf", "/etc/zabbix/zabbix_proxy.conf"] + RUN set -eux && \ addgroup --system --gid 1995 zabbix && \ adduser --system \ @@ -48,76 +70,9 @@ RUN set -eux && \ pcre \ sqlite-libs \ unixodbc && \ - rm -rf /var/cache/apk/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git -ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ - MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - apk add --no-cache --virtual build-dependencies \ - autoconf \ - automake \ - coreutils \ - curl-dev \ - libevent-dev \ - libssh-dev \ - libxml2-dev \ - net-snmp-dev \ - openipmi-dev \ - openldap-dev \ - pcre-dev \ - sqlite-dev \ - git \ - g++ \ - make \ - unixodbc-dev && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-agent \ - --enable-proxy \ - --with-sqlite3 \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - apk del --purge --no-network \ - build-dependencies && \ rm -rf /var/cache/apk/* EXPOSE 10051/TCP diff --git a/Dockerfiles/proxy-sqlite3/centos/Dockerfile b/Dockerfiles/proxy-sqlite3/centos/Dockerfile index 315fd90e8..216a81b90 100644 --- a/Dockerfiles/proxy-sqlite3/centos/Dockerfile +++ b/Dockerfiles/proxy-sqlite3/centos/Dockerfile @@ -1,27 +1,38 @@ -FROM centos:centos8 +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-sqlite3:centos-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + +FROM centos:8 + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm \ + ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL LABEL org.opencontainers.image.title="Zabbix proxy (SQLite3)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix proxy with SQLite3 database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM -ENV TINI_VERSION=v0.19.0 +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy", "/usr/sbin/zabbix_proxy"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_proxy.conf", "/etc/zabbix/zabbix_proxy.conf"] RUN set -eux && \ - ARCH_SUFFIX="$(arch)"; \ - case "$ARCH_SUFFIX" in \ - i686) export ARCH_SUFFIX='i386' ;; \ - x86_64) [ -f /lib64/ld-linux-x86-64.so.2 ] && export ARCH_SUFFIX='amd64' || export ARCH_SUFFIX='i386' ;; \ - aarch64) export ARCH_SUFFIX='arm64' ;; \ - armv7l) export ARCH_SUFFIX='armhf' ;; \ - ppc64el|ppc64le) export ARCH_SUFFIX='ppc64le' ;; \ - s390x) export ARCH_SUFFIX='s390x' ;; \ - *) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \ - esac; \ groupadd --system --gid 1995 zabbix && \ useradd \ --system --comment "Zabbix monitoring system" \ @@ -44,11 +55,9 @@ RUN set -eux && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /usr/lib/zabbix/externalscripts && \ mkdir -p /usr/share/doc/zabbix-proxy-sqlite3 && \ - dnf --quiet makecache && \ - dnf -y install epel-release && \ - dnf -y install --setopt=tsflags=nodocs --setopt=install_weak_deps=False --best \ - libcurl-minimal \ - libevent \ + REPOLIST="baseos,appstream,epel" && \ + INSTALL_PKGS="libevent \ + tini \ libssh \ fping \ file-libs \ @@ -59,97 +68,19 @@ RUN set -eux && \ openssl-libs \ pcre \ zlib \ - unixODBC && \ - curl -L "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${ARCH_SUFFIX}" -o /sbin/tini && \ - curl -L "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${ARCH_SUFFIX}.asc" -o /tmp/tini.asc && \ - export GNUPGHOME="$(mktemp -d)" && \ - for server in $(shuf -e ha.pool.sks-keyservers.net \ - hkp://p80.pool.sks-keyservers.net:80 \ - ipv4.pool.sks-keyservers.net \ - keyserver.ubuntu.com \ - keyserver.pgp.com \ - pgp.mit.edu) ; do \ - gpg --keyserver "$server" --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 && break || : ; \ - done && \ - gpg --batch --verify /tmp/tini.asc /sbin/tini && \ - rm -rf "$GNUPGHOME" /tmp/tini.asc && \ - chmod +x /sbin/tini && \ - dnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/CentOS-Linux-PowerTools.repo && \ - dnf --quiet makecache && \ - dnf -y install --setopt=tsflags=nodocs --setopt=install_weak_deps=False --best \ - autoconf \ - automake \ - gcc \ - pcre-devel \ - libcurl-devel \ - libevent-devel \ - libssh-devel \ - libxml2-devel \ - make \ - net-snmp-devel \ - OpenIPMI-devel \ - openldap-devel \ - sqlite-devel \ - git \ - unixODBC-devel && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-agent \ - --enable-proxy \ - --with-sqlite3 \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ - cat database/sqlite3/schema.sql > database/sqlite3/create.sql && \ - gzip database/sqlite3/create.sql && \ - cp database/sqlite3/create.sql.gz /usr/share/doc/zabbix-proxy-sqlite3/ && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ + unixODBC" && \ + dnf -y install epel-release && \ + dnf -y install \ + --disablerepo "*" \ + --enablerepo "${REPOLIST}" \ + --setopt=tsflags=nodocs \ + --setopt=install_weak_deps=False \ + --best \ + ${INSTALL_PKGS} && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - dnf -y history undo `dnf -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ dnf -y clean all && \ - sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/CentOS-Linux-PowerTools.repo && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki @@ -161,7 +92,7 @@ VOLUME ["/var/lib/zabbix/snmptraps"] COPY ["docker-entrypoint.sh", "/usr/bin/"] -ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/docker-entrypoint.sh"] +ENTRYPOINT ["/usr/bin/tini", "--", "/usr/bin/docker-entrypoint.sh"] USER 1997 diff --git a/Dockerfiles/proxy-sqlite3/ol/Dockerfile b/Dockerfiles/proxy-sqlite3/ol/Dockerfile index f52df60b1..d952a59b8 100644 --- a/Dockerfiles/proxy-sqlite3/ol/Dockerfile +++ b/Dockerfiles/proxy-sqlite3/ol/Dockerfile @@ -1,14 +1,36 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-sqlite3:ol-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm \ + ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + LABEL org.opencontainers.image.title="Zabbix proxy (SQLite3)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix proxy with SQLite3 database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy", "/usr/sbin/zabbix_proxy"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_proxy.conf", "/etc/zabbix/zabbix_proxy.conf"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -48,88 +70,18 @@ RUN set -eux && \ pcre \ zlib \ unixODBC" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ - microdnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - REPOLIST="ol8_baseos_latest,ol8_appstream,ol8_codeready_builder" && \ - INSTALL_PKGS="autoconf \ - automake \ - gcc \ - pcre-devel \ - libcurl-devel \ - libevent-devel \ - libssh-devel \ - libxml2-devel \ - make \ - net-snmp-devel \ - OpenIPMI-devel \ - openldap-devel \ - sqlite-devel \ - git \ - unixODBC-devel" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-agent \ - --enable-proxy \ - --with-sqlite3 \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ - cat database/sqlite3/schema.sql > database/sqlite3/create.sql && \ - gzip database/sqlite3/create.sql && \ - cp database/sqlite3/create.sql.gz /usr/share/doc/zabbix-proxy-sqlite3/ && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + microdnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/proxy-sqlite3/ol/README.md b/Dockerfiles/proxy-sqlite3/ol/README.md index 2a3c655d5..72cce7e2d 100644 --- a/Dockerfiles/proxy-sqlite3/ol/README.md +++ b/Dockerfiles/proxy-sqlite3/ol/README.md @@ -252,7 +252,7 @@ To minimize image size, it's uncommon for additional related tools (such as `git This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of. -## `zabbix-agent:ol-` +## `zabbix-proxy-sqlite3:ol-` Oracle Linux is an open-source operating system available under the GNU General Public License (GPLv2). Suitable for general purpose or Oracle workloads, it benefits from rigorous testing of more than 128,000 hours per day with real-world workloads and includes unique innovations such as Ksplice for zero-downtime kernel patching, DTrace for real-time diagnostics, the powerful Btrfs file system, and more. diff --git a/Dockerfiles/proxy-sqlite3/rhel/Dockerfile b/Dockerfiles/proxy-sqlite3/rhel/Dockerfile index aeefd57c0..5238681c8 100644 --- a/Dockerfiles/proxy-sqlite3/rhel/Dockerfile +++ b/Dockerfiles/proxy-sqlite3/rhel/Dockerfile @@ -53,7 +53,7 @@ RUN set -eux && INSTALL_PKGS="bash \ pcre \ sqlite-libs \ unixODBC" && \ - REPOLIST="ubi-8-baseos,ubi-8-appstream,rhel-8-for-x86_64-baseos-rpms,rhel-8-for-x86_64-appstream-rpms,epel" && \ + REPOLIST="ubi-8-baseos,ubi-8-appstream,rhel-8-for-x86_64-baseos-rpms,epel" && \ dnf -y update-minimal --disablerepo "*" --enablerepo "ubi-8-baseos" --setopt=tsflags=nodocs \ --security --sec-severity=Important --setopt=install_weak_deps=False --sec-severity=Critical && \ dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && \ diff --git a/Dockerfiles/proxy-sqlite3/ubuntu/Dockerfile b/Dockerfiles/proxy-sqlite3/ubuntu/Dockerfile index 72c53b945..1f19abed2 100644 --- a/Dockerfiles/proxy-sqlite3/ubuntu/Dockerfile +++ b/Dockerfiles/proxy-sqlite3/ubuntu/Dockerfile @@ -1,25 +1,38 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-sqlite3:ubuntu-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + FROM ubuntu:focal +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm \ + ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + LABEL org.opencontainers.image.title="Zabbix proxy (SQLite3)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix proxy with SQLite3 database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy", "/usr/sbin/zabbix_proxy"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_proxy.conf", "/etc/zabbix/zabbix_proxy.conf"] + RUN set -eux && \ - ARCH_SUFFIX="$(arch)"; \ - case "$ARCH_SUFFIX" in \ - i686) export ARCH_SUFFIX='i386' ;; \ - x86_64) [ -f /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ] && export ARCH_SUFFIX='amd64' || export ARCH_SUFFIX='i386' ;; \ - aarch64) export ARCH_SUFFIX='arm64' ;; \ - armv7l) export ARCH_SUFFIX='armhf' ;; \ - ppc64el|ppc64le) export ARCH_SUFFIX='ppc64le' ;; \ - s390x) export ARCH_SUFFIX='s390x' ;; \ - *) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \ - esac; \ echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d && \ groupadd --system --gid 1995 zabbix && \ useradd \ @@ -58,108 +71,22 @@ RUN set -eux && \ libxml2 \ snmp-mibs-downloader \ unixodbc && \ - apt-get -y autoremove && \ - apt-get -y clean && \ - rm -rf /var/lib/apt/lists/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - apt-get -y update && \ - DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \ - autoconf \ - automake \ - gcc \ - libc6-dev \ - libcurl4-openssl-dev \ - libevent-dev \ - libldap2-dev \ - libopenipmi-dev \ - libpcre3-dev \ - libsnmp-dev \ - libsqlite3-dev \ - libssh-dev \ - libxml2-dev \ - make \ - pkg-config \ - git \ - unixodbc-dev && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-agent \ - --enable-proxy \ - --with-sqlite3 \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - DEBIAN_FRONTEND=noninteractive apt-get -y purge \ - autoconf \ - automake \ - gcc \ - libc6-dev \ - libcurl4-openssl-dev \ - libevent-dev \ - libldap2-dev \ - libopenipmi-dev \ - libpcre3-dev \ - libsnmp-dev \ - libsqlite3-dev \ - libssh-dev \ - libxml2-dev \ - make \ - pkg-config \ - git \ - unixodbc-dev && \ apt-get -y autoremove && \ rm -rf /var/lib/apt/lists/* EXPOSE 10051/TCP - + WORKDIR /var/lib/zabbix - + VOLUME ["/var/lib/zabbix/snmptraps"] - + COPY ["docker-entrypoint.sh", "/usr/bin/"] ENTRYPOINT ["/usr/bin/tini", "--", "/usr/bin/docker-entrypoint.sh"] - + USER 1997 - + CMD ["/usr/sbin/zabbix_proxy", "--foreground", "-c", "/etc/zabbix/zabbix_proxy.conf"] diff --git a/Dockerfiles/server-mysql/alpine/Dockerfile b/Dockerfiles/server-mysql/alpine/Dockerfile index 17d4bcdc2..360a66f9c 100644 --- a/Dockerfiles/server-mysql/alpine/Dockerfile +++ b/Dockerfiles/server-mysql/alpine/Dockerfile @@ -1,14 +1,38 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:alpine-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM alpine:3.12 +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + LABEL org.opencontainers.image.title="Zabbix server (MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix server with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server", "/usr/sbin/zabbix_server"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_server.conf", "/etc/zabbix/zabbix_server.conf"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/mysql/create_server.sql.gz", "/usr/share/doc/zabbix-server-mysql/create.sql.gz"] + RUN set -eux && \ addgroup --system --gid 1995 zabbix && \ adduser --system \ @@ -53,80 +77,9 @@ RUN set -eux && \ openipmi-libs \ pcre \ unixodbc && \ - rm -rf /var/cache/apk/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ - MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - apk add --no-cache --virtual build-dependencies \ - autoconf \ - automake \ - coreutils \ - curl-dev \ - libevent-dev \ - libssh-dev \ - libxml2-dev \ - mysql-dev \ - net-snmp-dev \ - openipmi-dev \ - openldap-dev \ - pcre-dev \ - git \ - g++ \ - make \ - unixodbc-dev && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --prefix=/usr \ - --sysconfdir=/etc/zabbix \ - --enable-agent \ - --enable-server \ - --with-mysql \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_server/zabbix_server /usr/sbin/zabbix_server && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_server.conf /etc/zabbix/zabbix_server.conf && \ - cat database/mysql/schema.sql > database/mysql/create.sql && \ - cat database/mysql/images.sql >> database/mysql/create.sql && \ - cat database/mysql/data.sql >> database/mysql/create.sql && \ - gzip database/mysql/create.sql && \ - cp database/mysql/create.sql.gz /usr/share/doc/zabbix-server-mysql/ && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - apk del --purge --no-network \ - build-dependencies && \ rm -rf /var/cache/apk/* EXPOSE 10051/TCP diff --git a/Dockerfiles/server-mysql/centos/Dockerfile b/Dockerfiles/server-mysql/centos/Dockerfile index edbe2866e..c75d87336 100644 --- a/Dockerfiles/server-mysql/centos/Dockerfile +++ b/Dockerfiles/server-mysql/centos/Dockerfile @@ -1,27 +1,40 @@ -FROM centos:centos8 +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:centos-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + +FROM centos:8 + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm \ + ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL LABEL org.opencontainers.image.title="Zabbix server (MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix server with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM -ENV TINI_VERSION=v0.19.0 +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server", "/usr/sbin/zabbix_server"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_server.conf", "/etc/zabbix/zabbix_server.conf"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/mysql/create_server.sql.gz", "/usr/share/doc/zabbix-server-mysql/create.sql.gz"] RUN set -eux && \ - ARCH_SUFFIX="$(arch)"; \ - case "$ARCH_SUFFIX" in \ - i686) export ARCH_SUFFIX='i386' ;; \ - x86_64) [ -f /lib64/ld-linux-x86-64.so.2 ] && export ARCH_SUFFIX='amd64' || export ARCH_SUFFIX='i386' ;; \ - aarch64) export ARCH_SUFFIX='arm64' ;; \ - armv7l) export ARCH_SUFFIX='armhf' ;; \ - ppc64el|ppc64le) export ARCH_SUFFIX='ppc64le' ;; \ - s390x) export ARCH_SUFFIX='s390x' ;; \ - *) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \ - esac; \ groupadd --system --gid 1995 zabbix && \ useradd \ --system --comment "Zabbix monitoring system" \ @@ -45,10 +58,10 @@ RUN set -eux && \ mkdir -p /usr/lib/zabbix/alertscripts && \ mkdir -p /usr/lib/zabbix/externalscripts && \ mkdir -p /usr/share/doc/zabbix-server-mysql && \ - dnf --quiet makecache && \ - dnf -y install epel-release && \ - dnf -y install --setopt=tsflags=nodocs --setopt=install_weak_deps=False --best \ - fping \ + dnf -y module enable mysql && \ + REPOLIST="baseos,appstream,epel" && \ + INSTALL_PKGS="fping \ + tini \ file-libs \ tzdata \ iputils \ @@ -65,99 +78,19 @@ RUN set -eux && \ openssl-libs \ pcre \ zlib \ - unixODBC && \ - curl -L "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${ARCH_SUFFIX}" -o /sbin/tini && \ - curl -L "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${ARCH_SUFFIX}.asc" -o /tmp/tini.asc && \ - export GNUPGHOME="$(mktemp -d)" && \ - for server in $(shuf -e ha.pool.sks-keyservers.net \ - hkp://p80.pool.sks-keyservers.net:80 \ - ipv4.pool.sks-keyservers.net \ - keyserver.ubuntu.com \ - keyserver.pgp.com \ - pgp.mit.edu) ; do \ - gpg --keyserver "$server" --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 && break || : ; \ - done && \ - gpg --batch --verify /tmp/tini.asc /sbin/tini && \ - rm -rf "$GNUPGHOME" /tmp/tini.asc && \ - chmod +x /sbin/tini && \ - dnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/CentOS-Linux-PowerTools.repo && \ - dnf --quiet makecache && \ - dnf -y install --setopt=tsflags=nodocs --setopt=install_weak_deps=False --best \ - autoconf \ - automake \ - gcc \ - pcre-devel \ - libcurl-devel \ - libevent-devel \ - libssh-devel \ - libxml2-devel \ - make \ - mysql-devel \ - net-snmp-devel \ - OpenIPMI-devel \ - openldap-devel \ - git \ - unixODBC-devel && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --prefix=/usr \ - --sysconfdir=/etc/zabbix \ - --enable-agent \ - --enable-server \ - --with-mysql \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_server/zabbix_server /usr/sbin/zabbix_server && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_server.conf /etc/zabbix/zabbix_server.conf && \ - cat database/mysql/schema.sql > database/mysql/create.sql && \ - cat database/mysql/images.sql >> database/mysql/create.sql && \ - cat database/mysql/data.sql >> database/mysql/create.sql && \ - gzip database/mysql/create.sql && \ - cp database/mysql/create.sql.gz /usr/share/doc/zabbix-server-mysql/ && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ + unixODBC" && \ + dnf -y install epel-release && \ + dnf -y install \ + --disablerepo "*" \ + --enablerepo "${REPOLIST}" \ + --setopt=tsflags=nodocs \ + --setopt=install_weak_deps=False \ + --best \ + ${INSTALL_PKGS} && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - dnf -y history undo `dnf -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ dnf -y clean all && \ - sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/CentOS-Linux-PowerTools.repo && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki @@ -169,7 +102,7 @@ VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/export"] COPY ["docker-entrypoint.sh", "/usr/bin/"] -ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/docker-entrypoint.sh"] +ENTRYPOINT ["/usr/bin/tini", "--", "/usr/bin/docker-entrypoint.sh"] USER 1997 diff --git a/Dockerfiles/server-mysql/ol/Dockerfile b/Dockerfiles/server-mysql/ol/Dockerfile index 14a867ec4..b0cf91e43 100644 --- a/Dockerfiles/server-mysql/ol/Dockerfile +++ b/Dockerfiles/server-mysql/ol/Dockerfile @@ -1,14 +1,38 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm \ + ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + LABEL org.opencontainers.image.title="Zabbix server (MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix server with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server", "/usr/sbin/zabbix_server"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_server.conf", "/etc/zabbix/zabbix_server.conf"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/mysql/create_server.sql.gz", "/usr/share/doc/zabbix-server-mysql/create.sql.gz"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -55,90 +79,18 @@ RUN set -eux && \ pcre \ zlib \ unixODBC" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ - microdnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - REPOLIST="ol8_baseos_latest,ol8_appstream,ol8_codeready_builder" && \ - INSTALL_PKGS="autoconf \ - automake \ - gcc \ - pcre-devel \ - libcurl-devel \ - libevent-devel \ - libssh-devel \ - libxml2-devel \ - make \ - mysql-devel \ - net-snmp-devel \ - OpenIPMI-devel \ - openldap-devel \ - git \ - unixODBC-devel" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --prefix=/usr \ - --sysconfdir=/etc/zabbix \ - --enable-agent \ - --enable-server \ - --with-mysql \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_server/zabbix_server /usr/sbin/zabbix_server && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_server.conf /etc/zabbix/zabbix_server.conf && \ - cat database/mysql/schema.sql > database/mysql/create.sql && \ - cat database/mysql/images.sql >> database/mysql/create.sql && \ - cat database/mysql/data.sql >> database/mysql/create.sql && \ - gzip database/mysql/create.sql && \ - cp database/mysql/create.sql.gz /usr/share/doc/zabbix-server-mysql/ && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + microdnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/server-mysql/ol/README.md b/Dockerfiles/server-mysql/ol/README.md index 5a7932d25..6683fbbd9 100644 --- a/Dockerfiles/server-mysql/ol/README.md +++ b/Dockerfiles/server-mysql/ol/README.md @@ -273,7 +273,7 @@ To minimize image size, it's uncommon for additional related tools (such as `git This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of. -## `zabbix-agent:ol-` +## `zabbix-server-mysql:ol-` Oracle Linux is an open-source operating system available under the GNU General Public License (GPLv2). Suitable for general purpose or Oracle workloads, it benefits from rigorous testing of more than 128,000 hours per day with real-world workloads and includes unique innovations such as Ksplice for zero-downtime kernel patching, DTrace for real-time diagnostics, the powerful Btrfs file system, and more. diff --git a/Dockerfiles/server-mysql/ubuntu/Dockerfile b/Dockerfiles/server-mysql/ubuntu/Dockerfile index f100fffa1..6df3f496a 100644 --- a/Dockerfiles/server-mysql/ubuntu/Dockerfile +++ b/Dockerfiles/server-mysql/ubuntu/Dockerfile @@ -1,25 +1,40 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ubuntu-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM ubuntu:focal +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm \ + ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + LABEL org.opencontainers.image.title="Zabbix server (MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix server with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server", "/usr/sbin/zabbix_server"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_server.conf", "/etc/zabbix/zabbix_server.conf"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/mysql/create_server.sql.gz", "/usr/share/doc/zabbix-server-mysql/create.sql.gz"] + RUN set -eux && \ - ARCH_SUFFIX="$(arch)"; \ - case "$ARCH_SUFFIX" in \ - i686) export ARCH_SUFFIX='i386' ;; \ - x86_64) [ -f /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ] && export ARCH_SUFFIX='amd64' || export ARCH_SUFFIX='i386' ;; \ - aarch64) export ARCH_SUFFIX='arm64' ;; \ - armv7l) export ARCH_SUFFIX='armhf' ;; \ - ppc64el|ppc64le) export ARCH_SUFFIX='ppc64le' ;; \ - s390x) export ARCH_SUFFIX='s390x' ;; \ - *) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \ - esac; \ echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d && \ groupadd --system --gid 1995 zabbix && \ useradd \ @@ -64,101 +79,11 @@ RUN set -eux && \ mysql-client \ snmp-mibs-downloader \ unixodbc && \ - apt-get -y autoremove && \ - apt-get -y clean && \ - rm -rf /var/lib/apt/lists/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - apt-get -y update && \ - DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \ - autoconf \ - automake \ - gcc \ - libc6-dev \ - libcurl4-openssl-dev \ - libevent-dev \ - libldap2-dev \ - libmysqlclient-dev \ - libopenipmi-dev \ - libpcre3-dev \ - libsnmp-dev \ - libssh-dev \ - libxml2-dev \ - make \ - pkg-config \ - git \ - unixodbc-dev && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --prefix=/usr \ - --sysconfdir=/etc/zabbix \ - --enable-agent \ - --enable-server \ - --with-mysql \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_server/zabbix_server /usr/sbin/zabbix_server && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_server.conf /etc/zabbix/zabbix_server.conf && \ - cat database/mysql/schema.sql > database/mysql/create.sql && \ - cat database/mysql/images.sql >> database/mysql/create.sql && \ - cat database/mysql/data.sql >> database/mysql/create.sql && \ - gzip database/mysql/create.sql && \ - cp database/mysql/create.sql.gz /usr/share/doc/zabbix-server-mysql/ && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - DEBIAN_FRONTEND=noninteractive apt-get -y purge \ - autoconf \ - automake \ - gcc \ - libc6-dev \ - libcurl4-openssl-dev \ - libevent-dev \ - libldap2-dev \ - libmysqlclient-dev \ - libopenipmi-dev \ - libpcre3-dev \ - libsnmp-dev \ - libssh-dev \ - libxml2-dev \ - make \ - pkg-config \ - git \ - unixodbc-dev && \ apt-get -y autoremove && \ + apt-get -y clean && \ rm -rf /var/lib/apt/lists/* EXPOSE 10051/TCP diff --git a/Dockerfiles/server-pgsql/alpine/Dockerfile b/Dockerfiles/server-pgsql/alpine/Dockerfile index 95a85a811..fed09f198 100644 --- a/Dockerfiles/server-pgsql/alpine/Dockerfile +++ b/Dockerfiles/server-pgsql/alpine/Dockerfile @@ -1,14 +1,39 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-pgsql:alpine-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM alpine:3.12 +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + LABEL org.opencontainers.image.title="Zabbix server (PostgreSQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix server with PostgreSQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server", "/usr/sbin/zabbix_server"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_server.conf", "/etc/zabbix/zabbix_server.conf"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/postgresql/create_server.sql.gz", "/usr/share/doc/zabbix-server-postgresql/create.sql.gz"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/postgresql/timescaledb.sql", "/usr/share/doc/zabbix-server-postgresql/timescaledb.sql"] + RUN set -eux && \ addgroup --system --gid 1995 zabbix && \ adduser --system \ @@ -53,82 +78,9 @@ RUN set -eux && \ postgresql-client \ postgresql-libs \ unixodbc && \ - rm -rf /var/cache/apk/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ - MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - apk add --no-cache --virtual build-dependencies \ - alpine-sdk \ - autoconf \ - automake \ - coreutils \ - curl-dev \ - libevent-dev \ - libssh-dev \ - libxml2-dev \ - net-snmp-dev \ - openipmi-dev \ - openldap-dev \ - pcre-dev \ - postgresql-dev \ - git \ - g++ \ - make \ - unixodbc-dev && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --prefix=/usr \ - --sysconfdir=/etc/zabbix \ - --enable-agent \ - --enable-server \ - --with-postgresql \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_server/zabbix_server /usr/sbin/zabbix_server && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_server.conf /etc/zabbix/zabbix_server.conf && \ - cat database/postgresql/schema.sql > database/postgresql/create.sql && \ - cat database/postgresql/images.sql >> database/postgresql/create.sql && \ - cat database/postgresql/data.sql >> database/postgresql/create.sql && \ - gzip database/postgresql/create.sql && \ - cp database/postgresql/create.sql.gz /usr/share/doc/zabbix-server-postgresql/ && \ - cp database/postgresql/timescaledb.sql /usr/share/doc/zabbix-server-postgresql/ && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - apk del --purge --no-network \ - build-dependencies && \ rm -rf /var/cache/apk/* EXPOSE 10051/TCP diff --git a/Dockerfiles/server-pgsql/centos/Dockerfile b/Dockerfiles/server-pgsql/centos/Dockerfile index f63f8b84f..b3b250b63 100644 --- a/Dockerfiles/server-pgsql/centos/Dockerfile +++ b/Dockerfiles/server-pgsql/centos/Dockerfile @@ -1,27 +1,40 @@ -FROM centos:centos8 +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-pgsql:centos-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + +FROM centos:8 + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL LABEL org.opencontainers.image.title="Zabbix server (PostgreSQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix server with PostgreSQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM -ENV TINI_VERSION=v0.19.0 +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server", "/usr/sbin/zabbix_server"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_server.conf", "/etc/zabbix/zabbix_server.conf"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/postgresql/create_server.sql.gz", "/usr/share/doc/zabbix-server-postgresql/create.sql.gz"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/postgresql/timescaledb.sql", "/usr/share/doc/zabbix-server-postgresql/timescaledb.sql"] RUN set -eux && \ - ARCH_SUFFIX="$(arch)"; \ - case "$ARCH_SUFFIX" in \ - i686) export ARCH_SUFFIX='i386' ;; \ - x86_64) [ -f /lib64/ld-linux-x86-64.so.2 ] && export ARCH_SUFFIX='amd64' || export ARCH_SUFFIX='i386' ;; \ - aarch64) export ARCH_SUFFIX='arm64' ;; \ - armv7l) export ARCH_SUFFIX='armhf' ;; \ - ppc64el|ppc64le) export ARCH_SUFFIX='ppc64le' ;; \ - s390x) export ARCH_SUFFIX='s390x' ;; \ - *) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \ - esac; \ groupadd --system --gid 1995 zabbix && \ useradd \ --system --comment "Zabbix monitoring system" \ @@ -45,15 +58,13 @@ RUN set -eux && \ mkdir -p /usr/lib/zabbix/alertscripts && \ mkdir -p /usr/lib/zabbix/externalscripts && \ mkdir -p /usr/share/doc/zabbix-server-postgresql && \ - dnf --quiet makecache && \ - dnf -y install epel-release && \ - dnf -y install --setopt=tsflags=nodocs --setopt=install_weak_deps=False --best \ - fping \ + REPOLIST="baseos,appstream,epel" && \ + INSTALL_PKGS="fping \ file-libs \ + tini \ iputils \ tzdata \ traceroute \ - libcurl-minimal \ libevent \ libssh \ libxml2 \ @@ -65,100 +76,19 @@ RUN set -eux && \ postgresql \ postgresql-libs \ zlib \ - unixODBC && \ - curl -L "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${ARCH_SUFFIX}" -o /sbin/tini && \ - curl -L "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${ARCH_SUFFIX}.asc" -o /tmp/tini.asc && \ - export GNUPGHOME="$(mktemp -d)" && \ - for server in $(shuf -e ha.pool.sks-keyservers.net \ - hkp://p80.pool.sks-keyservers.net:80 \ - ipv4.pool.sks-keyservers.net \ - keyserver.ubuntu.com \ - keyserver.pgp.com \ - pgp.mit.edu) ; do \ - gpg --keyserver "$server" --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 && break || : ; \ - done && \ - gpg --batch --verify /tmp/tini.asc /sbin/tini && \ - rm -rf "$GNUPGHOME" /tmp/tini.asc && \ - chmod +x /sbin/tini && \ - dnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/CentOS-Linux-PowerTools.repo && \ - dnf --quiet makecache && \ - dnf -y install --setopt=tsflags=nodocs --setopt=install_weak_deps=False --best \ - autoconf \ - automake \ - gcc \ - pcre-devel \ - libcurl-devel \ - libevent-devel \ - libssh-devel \ - libxml2-devel \ - make \ - net-snmp-devel \ - OpenIPMI-devel \ - openldap-devel \ - postgresql-devel \ - git \ - unixODBC-devel && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --prefix=/usr \ - --sysconfdir=/etc/zabbix \ - --enable-agent \ - --enable-server \ - --with-postgresql \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_server/zabbix_server /usr/sbin/zabbix_server && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_server.conf /etc/zabbix/zabbix_server.conf && \ - cat database/postgresql/schema.sql > database/postgresql/create.sql && \ - cat database/postgresql/images.sql >> database/postgresql/create.sql && \ - cat database/postgresql/data.sql >> database/postgresql/create.sql && \ - gzip database/postgresql/create.sql && \ - cp database/postgresql/create.sql.gz /usr/share/doc/zabbix-server-postgresql/ && \ - cp database/postgresql/timescaledb.sql /usr/share/doc/zabbix-server-postgresql/timescaledb.sql && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ + unixODBC" && \ + dnf -y install epel-release && \ + dnf -y install \ + --disablerepo "*" \ + --enablerepo "${REPOLIST}" \ + --setopt=tsflags=nodocs \ + --setopt=install_weak_deps=False \ + --best \ + ${INSTALL_PKGS} && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - dnf -y history undo `dnf -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ dnf -y clean all && \ - sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/CentOS-Linux-PowerTools.repo && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki @@ -170,8 +100,8 @@ VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/export"] COPY ["docker-entrypoint.sh", "/usr/bin/"] -ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/docker-entrypoint.sh"] - +ENTRYPOINT ["/usr/bin/tini", "--", "/usr/bin/docker-entrypoint.sh"] + USER 1997 - + CMD ["/usr/sbin/zabbix_server", "--foreground", "-c", "/etc/zabbix/zabbix_server.conf"] diff --git a/Dockerfiles/server-pgsql/ol/Dockerfile b/Dockerfiles/server-pgsql/ol/Dockerfile index 3367029cc..933426b79 100644 --- a/Dockerfiles/server-pgsql/ol/Dockerfile +++ b/Dockerfiles/server-pgsql/ol/Dockerfile @@ -1,14 +1,38 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-pgsql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + LABEL org.opencontainers.image.title="Zabbix server (PostgreSQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix server with PostgreSQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server", "/usr/sbin/zabbix_server"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_server.conf", "/etc/zabbix/zabbix_server.conf"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/postgresql/create_server.sql.gz", "/usr/share/doc/zabbix-server-postgresql/create.sql.gz"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/postgresql/timescaledb.sql", "/usr/share/doc/zabbix-server-postgresql/timescaledb.sql"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -53,91 +77,18 @@ RUN set -eux && \ postgresql-libs \ zlib \ unixODBC" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ - microdnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - REPOLIST="ol8_baseos_latest,ol8_appstream,ol8_codeready_builder" && \ - INSTALL_PKGS="autoconf \ - automake \ - gcc \ - pcre-devel \ - libcurl-devel \ - libevent-devel \ - libssh-devel \ - libxml2-devel \ - make \ - net-snmp-devel \ - OpenIPMI-devel \ - openldap-devel \ - postgresql-devel \ - git \ - unixODBC-devel" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --prefix=/usr \ - --sysconfdir=/etc/zabbix \ - --enable-agent \ - --enable-server \ - --with-postgresql \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_server/zabbix_server /usr/sbin/zabbix_server && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_server.conf /etc/zabbix/zabbix_server.conf && \ - cat database/postgresql/schema.sql > database/postgresql/create.sql && \ - cat database/postgresql/images.sql >> database/postgresql/create.sql && \ - cat database/postgresql/data.sql >> database/postgresql/create.sql && \ - gzip database/postgresql/create.sql && \ - cp database/postgresql/create.sql.gz /usr/share/doc/zabbix-server-postgresql/ && \ - cp database/postgresql/timescaledb.sql /usr/share/doc/zabbix-server-postgresql/timescaledb.sql && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + microdnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/server-pgsql/ubuntu/Dockerfile b/Dockerfiles/server-pgsql/ubuntu/Dockerfile index 7e22f232a..4d77a66d6 100644 --- a/Dockerfiles/server-pgsql/ubuntu/Dockerfile +++ b/Dockerfiles/server-pgsql/ubuntu/Dockerfile @@ -1,25 +1,41 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-pgsql:ubuntu-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM ubuntu:focal +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm \ + ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + LABEL org.opencontainers.image.title="Zabbix server (PostgreSQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix server with PostgreSQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server", "/usr/sbin/zabbix_server"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_server.conf", "/etc/zabbix/zabbix_server.conf"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/postgresql/create_server.sql.gz", "/usr/share/doc/zabbix-server-postgresql/create.sql.gz"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/postgresql/timescaledb.sql", "/usr/share/doc/zabbix-server-postgresql/timescaledb.sql"] + RUN set -eux && \ - ARCH_SUFFIX="$(arch)"; \ - case "$ARCH_SUFFIX" in \ - i686) export ARCH_SUFFIX='i386' ;; \ - x86_64) [ -f /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ] && export ARCH_SUFFIX='amd64' || export ARCH_SUFFIX='i386' ;; \ - aarch64) export ARCH_SUFFIX='arm64' ;; \ - armv7l) export ARCH_SUFFIX='armhf' ;; \ - ppc64el|ppc64le) export ARCH_SUFFIX='ppc64le' ;; \ - s390x) export ARCH_SUFFIX='s390x' ;; \ - *) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \ - esac; \ echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d && \ groupadd --system --gid 1995 zabbix && \ useradd \ @@ -64,102 +80,11 @@ RUN set -eux && \ postgresql-client \ snmp-mibs-downloader \ unixodbc && \ - apt-get -y autoremove && \ - apt-get -y clean && \ - rm -rf /var/lib/apt/lists/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - apt-get -y update && \ - DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \ - autoconf \ - automake \ - gcc \ - libc6-dev \ - libcurl4-openssl-dev \ - libevent-dev \ - libldap2-dev \ - libopenipmi-dev \ - libpcre3-dev \ - libpq-dev \ - libsnmp-dev \ - libssh-dev \ - libxml2-dev \ - make \ - pkg-config \ - git \ - unixodbc-dev && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --prefix=/usr \ - --sysconfdir=/etc/zabbix \ - --enable-agent \ - --enable-server \ - --with-postgresql \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_server/zabbix_server /usr/sbin/zabbix_server && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_server.conf /etc/zabbix/zabbix_server.conf && \ - cat database/postgresql/schema.sql > database/postgresql/create.sql && \ - cat database/postgresql/images.sql >> database/postgresql/create.sql && \ - cat database/postgresql/data.sql >> database/postgresql/create.sql && \ - gzip database/postgresql/create.sql && \ - cp database/postgresql/create.sql.gz /usr/share/doc/zabbix-server-postgresql/ && \ - cp database/postgresql/timescaledb.sql /usr/share/doc/zabbix-server-postgresql/timescaledb.sql && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - DEBIAN_FRONTEND=noninteractive apt-get -y purge \ - autoconf \ - automake \ - gcc \ - libc6-dev \ - libcurl4-openssl-dev \ - libevent-dev \ - libldap2-dev \ - libopenipmi-dev \ - libpcre3-dev \ - libpq-dev \ - libsnmp-dev \ - libssh-dev \ - libxml2-dev \ - make \ - pkg-config \ - git \ - unixodbc-dev && \ apt-get -y autoremove && \ + apt-get -y clean && \ rm -rf /var/lib/apt/lists/* EXPOSE 10051/TCP diff --git a/Dockerfiles/snmptraps/centos/Dockerfile b/Dockerfiles/snmptraps/centos/Dockerfile index 90093b42b..3e8848348 100644 --- a/Dockerfiles/snmptraps/centos/Dockerfile +++ b/Dockerfiles/snmptraps/centos/Dockerfile @@ -29,8 +29,7 @@ RUN set -eux && \ --home-dir /var/lib/zabbix/ \ zabbix && \ dnf --quiet makecache && \ - dnf -y install epel-release && \ - dnf -y install --setopt=tsflags=nodocs --setopt=install_weak_deps=False --best \ + dnf -y install --setopt=tsflags=nodocs \ tzdata \ net-snmp && \ mkdir -p /var/lib/zabbix && \ diff --git a/Dockerfiles/snmptraps/ol/Dockerfile b/Dockerfiles/snmptraps/ol/Dockerfile index 432e15c19..cfdd679cb 100644 --- a/Dockerfiles/snmptraps/ol/Dockerfile +++ b/Dockerfiles/snmptraps/ol/Dockerfile @@ -1,7 +1,7 @@ FROM oraclelinux:8-slim ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.12 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ diff --git a/Dockerfiles/snmptraps/ol/README.md b/Dockerfiles/snmptraps/ol/README.md index b64578fd9..d638363c7 100644 --- a/Dockerfiles/snmptraps/ol/README.md +++ b/Dockerfiles/snmptraps/ol/README.md @@ -80,7 +80,7 @@ The volume allows to add new MIB files. It does not support subdirectories, all The `zabbix-snmptraps` images come in many flavors, each designed for a specific use case. -## `zabbix-agent2:alpine-` +## `zabbix-snmptraps:alpine-` This image is based on the popular [Alpine Linux project](http://alpinelinux.org), available in [the `alpine` official image](https://hub.docker.com/_/alpine). Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general. @@ -88,11 +88,11 @@ This variant is highly recommended when final image size being as small as possi To minimize image size, it's uncommon for additional related tools (such as `git` or `bash`) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the [`alpine` image description](https://hub.docker.com/_/alpine/) for examples of how to install packages if you are unfamiliar). -## `zabbix-agent:ubuntu-` +## `zabbix-snmptraps:ubuntu-` This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of. -## `zabbix-agent:ol-` +## `zabbix-snmptraps:ol-` Oracle Linux is an open-source operating system available under the GNU General Public License (GPLv2). Suitable for general purpose or Oracle workloads, it benefits from rigorous testing of more than 128,000 hours per day with real-world workloads and includes unique innovations such as Ksplice for zero-downtime kernel patching, DTrace for real-time diagnostics, the powerful Btrfs file system, and more. diff --git a/Dockerfiles/snmptraps/rhel/Dockerfile b/Dockerfiles/snmptraps/rhel/Dockerfile index 7b88f3b48..8bfdad94f 100644 --- a/Dockerfiles/snmptraps/rhel/Dockerfile +++ b/Dockerfiles/snmptraps/rhel/Dockerfile @@ -2,8 +2,8 @@ FROM registry.access.redhat.com/ubi8/ubi-minimal MAINTAINER Alexey Pustovalov ARG MAJOR_VERSION=5.0 -ARG RELEASE=12 -ARG ZBX_VERSION=${MAJOR_VERSION}.12 +ARG RELEASE=16 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} diff --git a/Dockerfiles/web-apache-mysql/alpine/Dockerfile b/Dockerfiles/web-apache-mysql/alpine/Dockerfile index 3035f6d59..d53429c95 100644 --- a/Dockerfiles/web-apache-mysql/alpine/Dockerfile +++ b/Dockerfiles/web-apache-mysql/alpine/Dockerfile @@ -1,14 +1,34 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:alpine-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM alpine:3.12 +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix web-interface (Apache, MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Apache2 web server with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] + RUN set -eux && \ addgroup --system --gid 1995 zabbix && \ adduser --system \ @@ -57,47 +77,22 @@ RUN set -eux && \ "/etc/apache2/conf.d/mpm.conf" && \ sed -i 's/Listen 80/Listen 8080/g' /etc/apache2/httpd.conf && \ rm -rf "/var/run/apache2/" && \ - rm -rf /var/cache/apk/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - apk add --no-cache --virtual build-dependencies \ - gettext \ - git && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \ rm -rf tests && \ - rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \ ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php" && \ ln -s "/etc/zabbix/web/maintenance.inc.php" "/usr/share/zabbix/conf/maintenance.inc.php" && \ - chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/modules/ && \ - chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/modules/ && \ - chmod -R g=u /etc/zabbix/ /usr/share/zabbix/modules/ && \ + find /usr/share/zabbix/locale -name '*.po' | xargs rm -f && \ + find /usr/share/zabbix/locale -name '*.sh' | xargs rm -f && \ + chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ + chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ + chmod -R g=u /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ chown --quiet -R zabbix:root /etc/apache2/ /etc/php7/ && \ chgrp -R 0 /etc/apache2/ /etc/php7/ && \ chmod -R g=u /etc/apache2/ /etc/php7/ && \ chown --quiet -R zabbix:root /usr/share/zabbix/include/defines.inc.php && \ chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \ chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \ - apk del --purge --no-network \ - build-dependencies && \ rm -rf /var/cache/apk/* EXPOSE 8080/TCP 8443/TCP diff --git a/Dockerfiles/web-apache-mysql/centos/Dockerfile b/Dockerfiles/web-apache-mysql/centos/Dockerfile index 9d341f369..7bb4d9d46 100644 --- a/Dockerfiles/web-apache-mysql/centos/Dockerfile +++ b/Dockerfiles/web-apache-mysql/centos/Dockerfile @@ -1,14 +1,34 @@ -FROM centos:centos8 +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:centos-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + +FROM centos:8 + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} LABEL org.opencontainers.image.title="Zabbix web-interface (Apache, MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Apache2 web server with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] + RUN set -eux && \ groupadd --system --gid 1995 zabbix && \ useradd \ @@ -21,11 +41,9 @@ RUN set -eux && \ mkdir -p /etc/zabbix && \ mkdir -p /etc/zabbix/web && \ mkdir -p /etc/zabbix/web/certs && \ - dnf --quiet makecache && \ - dnf -y install epel-release && \ - dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ - dejavu-sans-fonts \ - curl \ + dnf -y module enable mysql && \ + REPOLIST="baseos,appstream,epel" && \ + INSTALL_PKGS="curl \ httpd \ mysql \ mod_ssl \ @@ -38,7 +56,17 @@ RUN set -eux && \ php-mysqlnd \ php-json \ php-xml \ - supervisor && \ + findutils \ + glibc-locale-source \ + supervisor" && \ + dnf -y install epel-release && \ + dnf -y install \ + --disablerepo "*" \ + --enablerepo "${REPOLIST}" \ + --setopt=tsflags=nodocs \ + --setopt=install_weak_deps=False \ + --best \ + ${INSTALL_PKGS} && \ rm -f "/etc/httpd/conf.d/default.conf" && \ rm -f "/etc/httpd/conf.d/ssl.conf" && \ rm -f /etc/php-fpm.d/www.conf && \ @@ -47,36 +75,7 @@ RUN set -eux && \ -e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \ "/etc/httpd/conf/httpd.conf" && \ sed -i 's/Listen 80/Listen 8080/g' /etc/httpd/conf/httpd.conf && \ - dnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - dnf --quiet makecache && \ - dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ - glibc-locale-source && \ - dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ - gettext \ - git && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \ rm -rf tests && \ rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \ @@ -97,8 +96,9 @@ RUN set -eux && \ chown --quiet -R zabbix:root /usr/share/zabbix/include/defines.inc.php && \ chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \ chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \ - dnf -y history undo `dnf -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ - dnf -y erase glibc-locale-source glibc-langpack-en && \ + dnf -y remove \ + findutils \ + glibc-locale-source && \ dnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/web-apache-mysql/ol/Dockerfile b/Dockerfiles/web-apache-mysql/ol/Dockerfile index 050f262a3..ef5d0bcdc 100644 --- a/Dockerfiles/web-apache-mysql/ol/Dockerfile +++ b/Dockerfiles/web-apache-mysql/ol/Dockerfile @@ -1,14 +1,33 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix web-interface (Apache, MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Apache2 web server with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -38,11 +57,17 @@ RUN set -eux && \ php-mysqlnd \ php-json \ php-xml \ + findutils \ + glibc-locale-source \ supervisor" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ rm -f "/etc/httpd/conf.d/default.conf" && \ rm -f "/etc/httpd/conf.d/ssl.conf" && \ rm -f /etc/php-fpm.d/www.conf && \ @@ -51,39 +76,7 @@ RUN set -eux && \ -e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \ "/etc/httpd/conf/httpd.conf" && \ sed -i 's/Listen 80/Listen 8080/g' /etc/httpd/conf/httpd.conf && \ - microdnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - REPOLIST="ol8_baseos_latest,ol8_appstream,ol8_codeready_builder" && \ - INSTALL_PKGS="glibc-locale-source \ - gettext \ - findutils \ - git" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \ rm -rf tests && \ rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \ @@ -104,9 +97,10 @@ RUN set -eux && \ chown --quiet -R zabbix:root /usr/share/zabbix/include/defines.inc.php && \ chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \ chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + microdnf -y remove \ + findutils \ + glibc-locale-source && \ + microdnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/web-apache-mysql/ol/README.md b/Dockerfiles/web-apache-mysql/ol/README.md index 67ee8fd2f..9220280ec 100644 --- a/Dockerfiles/web-apache-mysql/ol/README.md +++ b/Dockerfiles/web-apache-mysql/ol/README.md @@ -236,7 +236,7 @@ The volume allows to use custom certificates for SAML authentification. The volu The `zabbix-web-apache-mysql` images come in many flavors, each designed for a specific use case. -## `zabbix-agent2:alpine-` +## `zabbix-web-apache-mysql:alpine-` This image is based on the popular [Alpine Linux project](http://alpinelinux.org), available in [the `alpine` official image](https://hub.docker.com/_/alpine). Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general. @@ -244,11 +244,11 @@ This variant is highly recommended when final image size being as small as possi To minimize image size, it's uncommon for additional related tools (such as `git` or `bash`) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the [`alpine` image description](https://hub.docker.com/_/alpine/) for examples of how to install packages if you are unfamiliar). -## `zabbix-agent:ubuntu-` +## `zabbix-web-apache-mysql:ubuntu-` This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of. -## `zabbix-agent:ol-` +## `zabbix-web-apache-mysql:ol-` Oracle Linux is an open-source operating system available under the GNU General Public License (GPLv2). Suitable for general purpose or Oracle workloads, it benefits from rigorous testing of more than 128,000 hours per day with real-world workloads and includes unique innovations such as Ksplice for zero-downtime kernel patching, DTrace for real-time diagnostics, the powerful Btrfs file system, and more. diff --git a/Dockerfiles/web-apache-mysql/ubuntu/Dockerfile b/Dockerfiles/web-apache-mysql/ubuntu/Dockerfile index 9375b7154..c34a80587 100644 --- a/Dockerfiles/web-apache-mysql/ubuntu/Dockerfile +++ b/Dockerfiles/web-apache-mysql/ubuntu/Dockerfile @@ -1,14 +1,34 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ubuntu-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM ubuntu:focal +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix web-interface (Apache, MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Apache2 web server with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] + RUN set -eux && \ echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d && \ groupadd --system --gid 1995 zabbix && \ @@ -52,37 +72,12 @@ RUN set -eux && \ sed -i 's/Listen 443/Listen 8443/g' /etc/apache2/ports.conf && \ sed -i 's|/var/run/apache2$SUFFIX|/tmp|g' /etc/apache2/envvars && \ rm -f /var/run/apache2/apache2.pid && \ - apt-get -y autoremove && \ - apt-get -y clean && \ - rm -rf /var/lib/apt/lists/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ apt-get -y update && \ DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \ - gettext \ - git && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ + gettext && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \ rm -rf tests && \ - rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \ ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php" && \ ln -s "/etc/zabbix/web/maintenance.inc.php" "/usr/share/zabbix/conf/maintenance.inc.php" && \ mkdir -p /var/lib/locales/supported.d/ && \ @@ -103,8 +98,7 @@ RUN set -eux && \ chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \ chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \ DEBIAN_FRONTEND=noninteractive apt-get -y purge \ - gettext \ - git && \ + gettext && \ apt-get -y autoremove && \ apt-get -y clean && \ rm -rf /var/lib/apt/lists/* diff --git a/Dockerfiles/web-apache-pgsql/alpine/Dockerfile b/Dockerfiles/web-apache-pgsql/alpine/Dockerfile index 2713474f1..07780f128 100644 --- a/Dockerfiles/web-apache-pgsql/alpine/Dockerfile +++ b/Dockerfiles/web-apache-pgsql/alpine/Dockerfile @@ -1,14 +1,34 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-pgsql:alpine-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM alpine:3.12 +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix web-interface (Apache, PostgreSQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Apache2 web server with PostgreSQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] + RUN set -eux && \ addgroup --system --gid 1995 zabbix && \ adduser --system \ @@ -33,7 +53,7 @@ RUN set -eux && \ php7-gd \ php7-gettext \ php7-json \ - php7-ldap \ + php7-ldap \ php7-pgsql \ php7-mbstring \ php7-session \ @@ -56,47 +76,21 @@ RUN set -eux && \ "/etc/apache2/conf.d/mpm.conf" && \ sed -i 's/Listen 80/Listen 8080/g' /etc/apache2/httpd.conf && \ rm -rf "/var/run/apache2/" && \ - rm -rf /var/cache/apk/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - apk add --no-cache --virtual build-dependencies \ - gettext \ - git && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \ rm -rf tests && \ rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \ ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php" && \ ln -s "/etc/zabbix/web/maintenance.inc.php" "/usr/share/zabbix/conf/maintenance.inc.php" && \ - chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/modules/ && \ - chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/modules/ && \ - chmod -R g=u /etc/zabbix/ /usr/share/zabbix/modules/ && \ + chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ + chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ + chmod -R g=u /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ chown --quiet -R zabbix:root /etc/apache2/ /etc/php7/ && \ chgrp -R 0 /etc/apache2/ /etc/php7/ && \ chmod -R g=u /etc/apache2/ /etc/php7/ && \ chown --quiet -R zabbix:root /usr/share/zabbix/include/defines.inc.php && \ chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \ chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \ - apk del --purge --no-network \ - build-dependencies && \ rm -rf /var/cache/apk/* EXPOSE 8080/TCP 8443/TCP diff --git a/Dockerfiles/web-apache-pgsql/alpine/docker-entrypoint.sh b/Dockerfiles/web-apache-pgsql/alpine/docker-entrypoint.sh index 6b30c60e6..ae5d2eae5 100755 --- a/Dockerfiles/web-apache-pgsql/alpine/docker-entrypoint.sh +++ b/Dockerfiles/web-apache-pgsql/alpine/docker-entrypoint.sh @@ -186,7 +186,7 @@ prepare_zbx_web_config() { export ZBX_DB_CA_FILE=${ZBX_DB_CA_FILE} : ${ZBX_DB_VERIFY_HOST:="false"} export ZBX_DB_VERIFY_HOST=${ZBX_DB_VERIFY_HOST,,} - + : ${DB_DOUBLE_IEEE754:="true"} export DB_DOUBLE_IEEE754=${DB_DOUBLE_IEEE754,,} diff --git a/Dockerfiles/web-apache-pgsql/centos/Dockerfile b/Dockerfiles/web-apache-pgsql/centos/Dockerfile index bd869af2d..3581afb46 100644 --- a/Dockerfiles/web-apache-pgsql/centos/Dockerfile +++ b/Dockerfiles/web-apache-pgsql/centos/Dockerfile @@ -1,14 +1,34 @@ -FROM centos:centos8 +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:centos-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + +FROM centos:8 + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} LABEL org.opencontainers.image.title="Zabbix web-interface (Apache, PostgreSQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Apache2 web server with PostgreSQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] + RUN set -eux && \ groupadd --system --gid 1995 zabbix && \ useradd \ @@ -21,11 +41,9 @@ RUN set -eux && \ mkdir -p /etc/zabbix && \ mkdir -p /etc/zabbix/web && \ mkdir -p /etc/zabbix/web/certs && \ - dnf --quiet makecache && \ - dnf -y install epel-release && \ - dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ - dejavu-sans-fonts \ - curl \ + dnf -y module enable php:7.4 && \ + REPOLIST="baseos,appstream,epel" && \ + INSTALL_PKGS="curl \ httpd \ mod_ssl \ php \ @@ -38,7 +56,17 @@ RUN set -eux && \ php-json \ php-xml \ postgresql \ - supervisor && \ + findutils \ + glibc-locale-source \ + supervisor" && \ + dnf -y install epel-release && \ + dnf -y install \ + --disablerepo "*" \ + --enablerepo "${REPOLIST}" \ + --setopt=tsflags=nodocs \ + --setopt=install_weak_deps=False \ + --best \ + ${INSTALL_PKGS} && \ rm -f "/etc/httpd/conf.d/default.conf" && \ rm -f "/etc/httpd/conf.d/ssl.conf" && \ rm -f /etc/php-fpm.d/www.conf && \ @@ -47,36 +75,7 @@ RUN set -eux && \ -e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \ "/etc/httpd/conf/httpd.conf" && \ sed -i 's/Listen 80/Listen 8080/g' /etc/httpd/conf/httpd.conf && \ - dnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - dnf --quiet makecache && \ - dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ - glibc-locale-source && \ - dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ - gettext \ - git && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \ rm -rf tests && \ rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \ @@ -97,8 +96,9 @@ RUN set -eux && \ chown --quiet -R zabbix:root /usr/share/zabbix/include/defines.inc.php && \ chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \ chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \ - dnf -y history undo `dnf -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ - dnf -y erase glibc-locale-source glibc-langpack-en && \ + dnf -y remove \ + findutils \ + glibc-locale-source && \ dnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/web-apache-pgsql/centos/docker-entrypoint.sh b/Dockerfiles/web-apache-pgsql/centos/docker-entrypoint.sh index 933f1e2e4..51fad5fd1 100755 --- a/Dockerfiles/web-apache-pgsql/centos/docker-entrypoint.sh +++ b/Dockerfiles/web-apache-pgsql/centos/docker-entrypoint.sh @@ -195,7 +195,7 @@ prepare_zbx_web_config() { export ZBX_DB_CA_FILE=${ZBX_DB_CA_FILE} : ${ZBX_DB_VERIFY_HOST:="false"} export ZBX_DB_VERIFY_HOST=${ZBX_DB_VERIFY_HOST,,} - + : ${DB_DOUBLE_IEEE754:="true"} export DB_DOUBLE_IEEE754=${DB_DOUBLE_IEEE754,,} diff --git a/Dockerfiles/web-apache-pgsql/ol/Dockerfile b/Dockerfiles/web-apache-pgsql/ol/Dockerfile index 13e2ed9a9..495fc0549 100644 --- a/Dockerfiles/web-apache-pgsql/ol/Dockerfile +++ b/Dockerfiles/web-apache-pgsql/ol/Dockerfile @@ -1,14 +1,33 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix web-interface (Apache, PostgreSQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Apache2 web server with PostgreSQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -37,11 +56,17 @@ RUN set -eux && \ php-json \ php-xml \ postgresql \ + findutils \ + glibc-locale-source \ supervisor" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ rm -f "/etc/httpd/conf.d/default.conf" && \ rm -f "/etc/httpd/conf.d/ssl.conf" && \ rm -f /etc/php-fpm.d/www.conf && \ @@ -50,39 +75,7 @@ RUN set -eux && \ -e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \ "/etc/httpd/conf/httpd.conf" && \ sed -i 's/Listen 80/Listen 8080/g' /etc/httpd/conf/httpd.conf && \ - microdnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - REPOLIST="ol8_baseos_latest,ol8_appstream,ol8_codeready_builder" && \ - INSTALL_PKGS="glibc-locale-source \ - gettext \ - findutils \ - git" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \ rm -rf tests && \ rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \ @@ -103,9 +96,10 @@ RUN set -eux && \ chown --quiet -R zabbix:root /usr/share/zabbix/include/defines.inc.php && \ chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \ chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + microdnf -y remove \ + findutils \ + glibc-locale-source && \ + microdnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/web-apache-pgsql/ol/docker-entrypoint.sh b/Dockerfiles/web-apache-pgsql/ol/docker-entrypoint.sh index 933f1e2e4..51fad5fd1 100755 --- a/Dockerfiles/web-apache-pgsql/ol/docker-entrypoint.sh +++ b/Dockerfiles/web-apache-pgsql/ol/docker-entrypoint.sh @@ -195,7 +195,7 @@ prepare_zbx_web_config() { export ZBX_DB_CA_FILE=${ZBX_DB_CA_FILE} : ${ZBX_DB_VERIFY_HOST:="false"} export ZBX_DB_VERIFY_HOST=${ZBX_DB_VERIFY_HOST,,} - + : ${DB_DOUBLE_IEEE754:="true"} export DB_DOUBLE_IEEE754=${DB_DOUBLE_IEEE754,,} diff --git a/Dockerfiles/web-apache-pgsql/ubuntu/Dockerfile b/Dockerfiles/web-apache-pgsql/ubuntu/Dockerfile index db2074530..1b5927a12 100644 --- a/Dockerfiles/web-apache-pgsql/ubuntu/Dockerfile +++ b/Dockerfiles/web-apache-pgsql/ubuntu/Dockerfile @@ -1,14 +1,34 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ubuntu-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM ubuntu:focal +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix web-interface (Apache, PostgreSQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Apache2 web server with PostgreSQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] + RUN set -eux && \ echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d && \ groupadd --system --gid 1995 zabbix && \ @@ -52,37 +72,12 @@ RUN set -eux && \ sed -i 's/Listen 443/Listen 8443/g' /etc/apache2/ports.conf && \ sed -i 's|/var/run/apache2$SUFFIX|/tmp|g' /etc/apache2/envvars && \ rm -f /var/run/apache2/apache2.pid && \ - apt-get -y autoremove && \ - apt-get -y clean && \ - rm -rf /var/lib/apt/lists/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ apt-get -y update && \ DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \ - gettext \ - git && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ + gettext && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \ rm -rf tests && \ - rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \ ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php" && \ ln -s "/etc/zabbix/web/maintenance.inc.php" "/usr/share/zabbix/conf/maintenance.inc.php" && \ mkdir -p /var/lib/locales/supported.d/ && \ @@ -103,8 +98,7 @@ RUN set -eux && \ chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \ chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \ DEBIAN_FRONTEND=noninteractive apt-get -y purge \ - gettext \ - git && \ + gettext && \ apt-get -y autoremove && \ apt-get -y clean && \ rm -rf /var/lib/apt/lists/* diff --git a/Dockerfiles/web-nginx-mysql/alpine/Dockerfile b/Dockerfiles/web-nginx-mysql/alpine/Dockerfile index 6b066230d..5fc788624 100644 --- a/Dockerfiles/web-nginx-mysql/alpine/Dockerfile +++ b/Dockerfiles/web-nginx-mysql/alpine/Dockerfile @@ -1,14 +1,34 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:alpine-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM alpine:3.12 +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix web-interface (Nginx, MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Nginx web server with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] + RUN set -eux && \ addgroup --system --gid 1995 zabbix && \ adduser --system \ @@ -50,40 +70,15 @@ RUN set -eux && \ rm -rf /etc/php7/php-fpm.d/www.conf && \ rm -f /etc/nginx/conf.d/*.conf && \ ln -sf /dev/fd/2 /var/lib/nginx/logs/error.log && \ - rm -rf /var/cache/apk/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - apk add --no-cache --virtual build-dependencies \ - coreutils \ - gettext \ - git && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \ rm -rf tests && \ rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \ ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php" && \ ln -s "/etc/zabbix/web/maintenance.inc.php" "/usr/share/zabbix/conf/maintenance.inc.php" && \ - chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/modules/ && \ - chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/modules/ && \ - chmod -R g=u /etc/zabbix/ /usr/share/zabbix/modules/ && \ + chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ + chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ + chmod -R g=u /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ chown --quiet -R zabbix:root /etc/nginx/ /etc/php7/php-fpm.d/ /etc/php7/php-fpm.conf && \ chgrp -R 0 /etc/nginx/ /etc/php7/php-fpm.d/ /etc/php7/php-fpm.conf && \ chmod -R g=u /etc/nginx/ /etc/php7/php-fpm.d/ /etc/php7/php-fpm.conf && \ @@ -93,8 +88,6 @@ RUN set -eux && \ chown --quiet -R zabbix:root /usr/share/zabbix/include/defines.inc.php && \ chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \ chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \ - apk del --purge --no-network \ - build-dependencies && \ rm -rf /var/cache/apk/* EXPOSE 8080/TCP 8443/TCP diff --git a/Dockerfiles/web-nginx-mysql/centos/Dockerfile b/Dockerfiles/web-nginx-mysql/centos/Dockerfile index 6bdcb0c38..6978e7ac9 100644 --- a/Dockerfiles/web-nginx-mysql/centos/Dockerfile +++ b/Dockerfiles/web-nginx-mysql/centos/Dockerfile @@ -1,14 +1,34 @@ -FROM centos:centos8 +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:centos-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + +FROM centos:8 + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} LABEL org.opencontainers.image.title="Zabbix web-interface (Nginx, MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Nginx web server with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] + RUN set -eux && \ groupadd --system --gid 1995 zabbix && \ useradd \ @@ -22,10 +42,10 @@ RUN set -eux && \ mkdir -p /etc/zabbix/web && \ mkdir -p /etc/zabbix/web/certs && \ mkdir -p /var/lib/php/session && \ - dnf --quiet makecache && \ - dnf -y install epel-release && \ - dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ - curl \ + dnf -y module enable mysql && \ + dnf -y module enable php:7.4 nginx:1.18 && \ + REPOLIST="baseos,appstream,epel" && \ + INSTALL_PKGS="curl \ mysql \ nginx \ php-bcmath \ @@ -36,39 +56,21 @@ RUN set -eux && \ php-mysqlnd \ php-json \ php-xml \ - supervisor && \ + findutils \ + glibc-locale-source \ + supervisor" && \ + dnf -y install epel-release && \ + dnf -y install \ + --disablerepo "*" \ + --enablerepo "${REPOLIST}" \ + --setopt=tsflags=nodocs \ + --setopt=install_weak_deps=False \ + --best \ + ${INSTALL_PKGS} && \ rm -f /etc/nginx/conf.d/*.conf && \ rm -f /etc/php-fpm.d/www.conf && \ - dnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - dnf --quiet makecache && \ - dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ - glibc-locale-source && \ - dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ - gettext \ - git && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \ rm -rf tests && \ rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \ @@ -89,8 +91,9 @@ RUN set -eux && \ chown --quiet -R zabbix:root /usr/share/zabbix/include/defines.inc.php && \ chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \ chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \ - dnf -y history undo `dnf -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ - dnf -y erase glibc-locale-source glibc-langpack-en && \ + dnf -y remove \ + findutils \ + glibc-locale-source && \ dnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/web-nginx-mysql/centos/README.md b/Dockerfiles/web-nginx-mysql/centos/README.md index d9eba0f3d..10e38b069 100644 --- a/Dockerfiles/web-nginx-mysql/centos/README.md +++ b/Dockerfiles/web-nginx-mysql/centos/README.md @@ -138,7 +138,6 @@ The variable is timezone in PHP format. Full list of supported timezones are ava The variable is visible Zabbix installation name in right top corner of the web interface. - ### `DB_DOUBLE_IEEE754` Use IEEE754 compatible value range for 64-bit Numeric (float) history values. Available since 5.0.0. Enabled by default. diff --git a/Dockerfiles/web-nginx-mysql/ol/Dockerfile b/Dockerfiles/web-nginx-mysql/ol/Dockerfile index 7b29fe6f2..5aed76052 100644 --- a/Dockerfiles/web-nginx-mysql/ol/Dockerfile +++ b/Dockerfiles/web-nginx-mysql/ol/Dockerfile @@ -1,14 +1,33 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix web-interface (Nginx, MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Nginx web server with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -37,46 +56,20 @@ RUN set -eux && \ php-mysqlnd \ php-json \ php-xml \ + findutils \ + glibc-locale-source \ supervisor" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ rm -f /etc/nginx/conf.d/*.conf && \ rm -f /etc/php-fpm.d/www.conf && \ - microdnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - REPOLIST="ol8_baseos_latest,ol8_appstream,ol8_codeready_builder" && \ - INSTALL_PKGS="glibc-locale-source \ - gettext \ - findutils \ - git" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \ rm -rf tests && \ rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \ @@ -97,9 +90,10 @@ RUN set -eux && \ chown --quiet -R zabbix:root /usr/share/zabbix/include/defines.inc.php && \ chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \ chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + microdnf -y remove \ + findutils \ + glibc-locale-source && \ + microdnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/web-nginx-mysql/ol/README.md b/Dockerfiles/web-nginx-mysql/ol/README.md index f19e88149..d9eba0f3d 100644 --- a/Dockerfiles/web-nginx-mysql/ol/README.md +++ b/Dockerfiles/web-nginx-mysql/ol/README.md @@ -237,7 +237,7 @@ The volume allows to use custom certificates for SAML authentification. The volu The `zabbix-web-nginx-mysql` images come in many flavors, each designed for a specific use case. -## `zabbix-agent2:alpine-` +## `zabbix-web-nginx-mysql:alpine-` This image is based on the popular [Alpine Linux project](http://alpinelinux.org), available in [the `alpine` official image](https://hub.docker.com/_/alpine). Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general. @@ -245,11 +245,11 @@ This variant is highly recommended when final image size being as small as possi To minimize image size, it's uncommon for additional related tools (such as `git` or `bash`) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the [`alpine` image description](https://hub.docker.com/_/alpine/) for examples of how to install packages if you are unfamiliar). -## `zabbix-agent:ubuntu-` +## `zabbix-web-nginx-mysql:ubuntu-` This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of. -## `zabbix-agent:ol-` +## `zabbix-web-nginx-mysql:ol-` Oracle Linux is an open-source operating system available under the GNU General Public License (GPLv2). Suitable for general purpose or Oracle workloads, it benefits from rigorous testing of more than 128,000 hours per day with real-world workloads and includes unique innovations such as Ksplice for zero-downtime kernel patching, DTrace for real-time diagnostics, the powerful Btrfs file system, and more. diff --git a/Dockerfiles/web-nginx-mysql/ubuntu/Dockerfile b/Dockerfiles/web-nginx-mysql/ubuntu/Dockerfile index e97a4b299..a5cd13f39 100644 --- a/Dockerfiles/web-nginx-mysql/ubuntu/Dockerfile +++ b/Dockerfiles/web-nginx-mysql/ubuntu/Dockerfile @@ -1,14 +1,34 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ubuntu-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM ubuntu:focal +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix web-interface (Nginx, MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Nginx web server with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] + RUN set -eux && \ echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d && \ groupadd --system --gid 1995 zabbix && \ @@ -44,7 +64,8 @@ RUN set -eux && \ DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CODENAME') && \ echo "deb https://nginx.org/packages/ubuntu/ $DISTRIB_CODENAME nginx" >> /etc/apt/sources.list.d/nginx.list && \ apt-get -y update && \ - DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \ + DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends \ + -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install \ curl \ mysql-client \ nginx \ @@ -62,38 +83,11 @@ RUN set -eux && \ rm -rf /var/cache/nginx/ && \ rm -f /etc/php/7.4/fpm/pool.d/www.conf && \ ln -sf /dev/fd/2 /var/log/nginx/error.log && \ + rm -f /etc/php/7.4/fpm/php-fpm.conf.dpkg-dist && \ DEBIAN_FRONTEND=noninteractive apt-get -y purge gpg dirmngr gpg-agent && \ - apt-get -y autoremove && \ - apt-get -y clean && \ - rm -rf /var/lib/apt/lists/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - apt-get -y update && \ - DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \ - gettext \ - git && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \ rm -rf tests && \ - rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \ ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php" && \ ln -s "/etc/zabbix/web/maintenance.inc.php" "/usr/share/zabbix/conf/maintenance.inc.php" && \ mkdir -p /var/lib/locales/supported.d/ && \ @@ -104,9 +98,9 @@ RUN set -eux && \ dpkg-reconfigure locales && \ find /usr/share/zabbix/locale -name '*.po' | xargs rm -f && \ find /usr/share/zabbix/locale -name '*.sh' | xargs rm -f && \ - chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/modules/ && \ - chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/modules/ && \ - chmod -R g=u /etc/zabbix/ /usr/share/zabbix/modules/ && \ + chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ + chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ + chmod -R g=u /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ chown --quiet -R zabbix:root /etc/nginx/ /etc/php/7.4/fpm/php-fpm.conf /etc/php/7.4/fpm/pool.d/ && \ chgrp -R 0 /etc/nginx/ /etc/php/7.4/fpm/php-fpm.conf /etc/php/7.4/fpm/pool.d/ && \ chmod -R g=u /etc/nginx/ /etc/php/7.4/fpm/php-fpm.conf /etc/php/7.4/fpm/pool.d/ && \ @@ -116,9 +110,6 @@ RUN set -eux && \ chown --quiet -R zabbix:root /usr/share/zabbix/include/defines.inc.php && \ chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \ chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \ - DEBIAN_FRONTEND=noninteractive apt-get -y purge \ - gettext \ - git && \ apt-get -y autoremove && \ apt-get -y clean && \ rm -rf /var/lib/apt/lists/* diff --git a/Dockerfiles/web-nginx-pgsql/alpine/Dockerfile b/Dockerfiles/web-nginx-pgsql/alpine/Dockerfile index 07722d451..b5cf86242 100644 --- a/Dockerfiles/web-nginx-pgsql/alpine/Dockerfile +++ b/Dockerfiles/web-nginx-pgsql/alpine/Dockerfile @@ -1,14 +1,34 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-pgsql:alpine-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM alpine:3.12 +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix web-interface (Nginx, PostgreSQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Nginx web server with PostgreSQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] + RUN set -eux && \ addgroup --system --gid 1995 zabbix && \ adduser --system \ @@ -49,40 +69,15 @@ RUN set -eux && \ rm -rf /etc/php7/php-fpm.d/www.conf && \ rm -f /etc/nginx/conf.d/*.conf && \ ln -sf /dev/fd/2 /var/lib/nginx/logs/error.log && \ - rm -rf /var/cache/apk/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - apk add --no-cache --virtual build-dependencies \ - coreutils \ - gettext \ - git && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \ rm -rf tests && \ rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \ ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php" && \ ln -s "/etc/zabbix/web/maintenance.inc.php" "/usr/share/zabbix/conf/maintenance.inc.php" && \ - chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/modules/ && \ - chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/modules/ && \ - chmod -R g=u /etc/zabbix/ /usr/share/zabbix/modules/ && \ + chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ + chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ + chmod -R g=u /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ chown --quiet -R zabbix:root /etc/nginx/ /etc/php7/php-fpm.d/ /etc/php7/php-fpm.conf && \ chgrp -R 0 /etc/nginx/ /etc/php7/php-fpm.d/ /etc/php7/php-fpm.conf && \ chmod -R g=u /etc/nginx/ /etc/php7/php-fpm.d/ /etc/php7/php-fpm.conf && \ @@ -92,8 +87,6 @@ RUN set -eux && \ chown --quiet -R zabbix:root /usr/share/zabbix/include/defines.inc.php && \ chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \ chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \ - apk del --purge --no-network \ - build-dependencies && \ rm -rf /var/cache/apk/* EXPOSE 8080/TCP 8443/TCP diff --git a/Dockerfiles/web-nginx-pgsql/centos/Dockerfile b/Dockerfiles/web-nginx-pgsql/centos/Dockerfile index c8c75d6a9..22ffd8c64 100644 --- a/Dockerfiles/web-nginx-pgsql/centos/Dockerfile +++ b/Dockerfiles/web-nginx-pgsql/centos/Dockerfile @@ -1,14 +1,34 @@ -FROM centos:centos8 +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-pgsql:centos-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + +FROM centos:8 + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} LABEL org.opencontainers.image.title="Zabbix web-interface (Nginx, PostgreSQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Nginx web server with PostgreSQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] + RUN set -eux && \ groupadd --system --gid 1995 zabbix && \ useradd \ @@ -22,10 +42,9 @@ RUN set -eux && \ mkdir -p /etc/zabbix/web && \ mkdir -p /etc/zabbix/web/certs && \ mkdir -p /var/lib/php/session && \ - dnf --quiet makecache && \ - dnf -y install epel-release && \ - dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ - supervisor \ + dnf -y module enable php:7.4 nginx:1.18 && \ + REPOLIST="baseos,appstream,epel" && \ + INSTALL_PKGS="supervisor \ curl \ nginx \ postgresql \ @@ -36,39 +55,20 @@ RUN set -eux && \ php-mbstring \ php-pgsql \ php-json \ - php-xml && \ + findutils \ + glibc-locale-source \ + php-xml" && \ + dnf -y install epel-release && \ + dnf -y install \ + --disablerepo "*" \ + --enablerepo "${REPOLIST}" \ + --setopt=tsflags=nodocs \ + --setopt=install_weak_deps=False \ + --best \ + ${INSTALL_PKGS} && \ rm -f /etc/nginx/conf.d/*.conf && \ rm -f /etc/php-fpm.d/www.conf && \ - dnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - dnf --quiet makecache && \ - dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ - glibc-locale-source && \ - dnf -y install --setopt=install_weak_deps=False --best --setopt=tsflags=nodocs \ - gettext \ - git && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \ rm -rf tests && \ rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \ @@ -89,8 +89,9 @@ RUN set -eux && \ chown --quiet -R zabbix:root /usr/share/zabbix/include/defines.inc.php && \ chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \ chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \ - dnf -y history undo `dnf -q history | sed -n 3p |column -t | cut -d' ' -f1` && \ - dnf -y erase glibc-locale-source glibc-langpack-en && \ + dnf -y remove \ + findutils \ + glibc-locale-source && \ dnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/web-nginx-pgsql/ol/Dockerfile b/Dockerfiles/web-nginx-pgsql/ol/Dockerfile index 2a8383bc2..4f7921c5e 100644 --- a/Dockerfiles/web-nginx-pgsql/ol/Dockerfile +++ b/Dockerfiles/web-nginx-pgsql/ol/Dockerfile @@ -1,14 +1,33 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-pgsql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix web-interface (Nginx, PostgreSQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Nginx web server with PostgreSQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -36,46 +55,20 @@ RUN set -eux && \ php-mbstring \ php-pgsql \ php-json \ + findutils \ + glibc-locale-source \ php-xml" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ rm -f /etc/nginx/conf.d/*.conf && \ rm -f /etc/php-fpm.d/www.conf && \ - microdnf -y clean all && \ - rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ - rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - REPOLIST="ol8_baseos_latest,ol8_appstream,ol8_codeready_builder" && \ - INSTALL_PKGS="glibc-locale-source \ - gettext \ - findutils \ - git" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \ rm -rf tests && \ rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \ @@ -96,9 +89,10 @@ RUN set -eux && \ chown --quiet -R zabbix:root /usr/share/zabbix/include/defines.inc.php && \ chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \ chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + microdnf -y remove \ + findutils \ + glibc-locale-source && \ + microdnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/web-nginx-pgsql/ol/README.md b/Dockerfiles/web-nginx-pgsql/ol/README.md index 2ea0df51b..6a20987a2 100644 --- a/Dockerfiles/web-nginx-pgsql/ol/README.md +++ b/Dockerfiles/web-nginx-pgsql/ol/README.md @@ -44,43 +44,43 @@ Zabbix web interface available in four editions: - Zabbix web-interface based on Nginx web server with MySQL database support - Zabbix web-interface based on Nginx web server with PostgreSQL database support -The image based on Apache2 web server with PostgreSQL database support. +The image based on Nginx web server with PostgreSQL database support. # How to use this image -## Start `zabbix-web-apache-pgsql` +## Start `zabbix-web-nginx-pgsql` Start a Zabbix web-interface container as follows: - docker run --name some-zabbix-web-apache-pgsql -e DB_SERVER_HOST="some-postgres-server" -e POSTGRES_USER="some-user" -e POSTGRES_PASSWORD="some-password" -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-apache-pgsql:tag + docker run --name some-zabbix-web-nginx-pgsql -e DB_SERVER_HOST="some-postgres-server" -e POSTGRES_USER="some-user" -e POSTGRES_PASSWORD="some-password" -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-nginx-pgsql:tag -Where `some-zabbix-web-apache-pgsql` is the name you want to assign to your container, `some-postgres-server` is IP or DNS name of PostgreSQL server, `some-user` is user to connect to Zabbix database on PostgreSQL server, `some-password` is the password to connect to PostgreSQL server, `some-zabbix-server` is IP or DNS name of Zabbix server or proxy, `some-timezone` is PHP like timezone name and `tag` is the tag specifying the version you want. See the list above for relevant tags, or look at the [full list of tags](https://hub.docker.com/r/zabbix/zabbix-web-apache-pgsql/tags/). +Where `some-zabbix-web-nginx-pgsql` is the name you want to assign to your container, `some-postgres-server` is IP or DNS name of PostgreSQL server, `some-user` is user to connect to Zabbix database on PostgreSQL server, `some-password` is the password to connect to PostgreSQL server, `some-zabbix-server` is IP or DNS name of Zabbix server or proxy, `some-timezone` is PHP like timezone name and `tag` is the tag specifying the version you want. See the list above for relevant tags, or look at the [full list of tags](https://hub.docker.com/r/zabbix/zabbix-web-nginx-pgsql/tags/). ## Linking the container to Zabbix server - docker run --name some-zabbix-web-apache-pgsql --link some-zabbix-server:zabbix-server -e DB_SERVER_HOST="some-postgres-server" -e POSTGRES_USER="some-user" -e POSTGRES_PASSWORD="some-password" -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-apache-pgsql:tag + docker run --name some-zabbix-web-nginx-pgsql --link some-zabbix-server:zabbix-server -e DB_SERVER_HOST="some-postgres-server" -e POSTGRES_USER="some-user" -e POSTGRES_PASSWORD="some-password" -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-nginx-pgsql:tag ## Linking the container to PostgreSQL database - docker run --name some-zabbix-web-apache-pgsql --link some-postgres-server:postgres -e DB_SERVER_HOST="some-postgres-server" -e POSTGRES_USER="some-user" -e POSTGRES_PASSWORD="some-password" -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-apache-pgsql:tag + docker run --name some-zabbix-web-nginx-pgsql --link some-postgres-server:postgres -e DB_SERVER_HOST="some-postgres-server" -e POSTGRES_USER="some-user" -e POSTGRES_PASSWORD="some-password" -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-nginx-pgsql:tag ## Container shell access and viewing Zabbix web interface logs -The `docker exec` command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your `zabbix-web-apache-pgsql` container: +The `docker exec` command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your `zabbix-web-nginx-pgsql` container: ```console -$ docker exec -ti some-zabbix-web-apache-pgsql /bin/bash +$ docker exec -ti some-zabbix-web-nginx-pgsql /bin/bash ``` The Zabbix web interface log is available through Docker's container log: ```console -$ docker logs some-zabbix-web-apache-pgsql +$ docker logs some-zabbix-web-nginx-pgsql ``` ## Environment Variables -When you start the `zabbix-web-apache-pgsql` image, you can adjust the configuration of the Zabbix web interface by passing one or more environment variables on the `docker run` command line. +When you start the `zabbix-web-nginx-pgsql` image, you can adjust the configuration of the Zabbix web interface by passing one or more environment variables on the `docker run` command line. ### `ZBX_SERVER_HOST` @@ -103,7 +103,7 @@ This variable is port of PostgreSQL server. By default, value is '5432'. These variables are used by Zabbix web interface to connect to Zabbix database. With the `_FILE` variables you can instead provide the path to a file which contains the user / the password instead. Without Docker Swarm or Kubernetes you also have to map the files. Those are exclusive so you can just provide one type - either `POSTGRES_USER` or `POSTGRES_USER_FILE`! ```console -docker run --name some-zabbix-web-apache-pgsql -e DB_SERVER_HOST="some-postgres-server" -v ./.POSTGRES_USER:/run/secrets/POSTGRES_USER -e POSTGRES_USER_FILE=/run/secrets/POSTGRES_USER -v ./.POSTGRES_PASSWORD:/run/secrets/POSTGRES_PASSWORD -e POSTGRES_PASSWORD_FILE=/var/run/secrets/POSTGRES_PASSWORD -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-apache-pgsql:tag +docker run --name some-zabbix-web-nginx-pgsql -e DB_SERVER_HOST="some-postgres-server" -v ./.POSTGRES_USER:/run/secrets/POSTGRES_USER -e POSTGRES_USER_FILE=/run/secrets/POSTGRES_USER -v ./.POSTGRES_PASSWORD:/run/secrets/POSTGRES_PASSWORD -e POSTGRES_PASSWORD_FILE=/var/run/secrets/POSTGRES_PASSWORD -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-nginx-pgsql:tag ``` With Docker Swarm or Kubernetes this works with secrets. That way it is replicated in your cluster! @@ -111,7 +111,7 @@ With Docker Swarm or Kubernetes this works with secrets. That way it is replicat ```console printf "zabbix" | docker secret create POSTGRES_USER - printf "zabbix" | docker secret create POSTGRES_PASSWORD - -docker run --name some-zabbix-web-apache-pgsql -e DB_SERVER_HOST="some-postgres-server" -e POSTGRES_USER_FILE=/run/secrets/POSTGRES_USER -e POSTGRES_PASSWORD_FILE=/run/secrets/POSTGRES_PASSWORD -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-apache-pgsql:tag +docker run --name some-zabbix-web-nginx-pgsql -e DB_SERVER_HOST="some-postgres-server" -e POSTGRES_USER_FILE=/run/secrets/POSTGRES_USER -e POSTGRES_PASSWORD_FILE=/run/secrets/POSTGRES_PASSWORD -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-nginx-pgsql:tag ``` By default, values for `POSTGRES_USER` and `POSTGRES_PASSWORD` are `zabbix`, `zabbix`. @@ -220,11 +220,11 @@ VAULT_TOKEN= # Available since 5.2.0 ## Allowed volumes for the Zabbix web interface container -### ``/etc/ssl/apache2`` +### ``/etc/ssl/nginx`` -The volume allows to enable HTTPS for the Zabbix web interface. The volume must contains two files ``ssl.crt`` and ``ssl.key`` prepared for Apache2 SSL connections. +The volume allows to enable HTTPS for the Zabbix web interface. The volume must contains three files ``ssl.crt``, ``ssl.key`` and ``dhparam.pem`` prepared for Nginx SSL connections. -Please follow official Apache2 [documentation](https://httpd.apache.org/docs/2.4/ssl/ssl_howto.html) to get more details about how to create certificate files. +Please follow official Nginx [documentation](http://nginx.org/en/docs/http/configuring_https_servers.html) to get more details about how to create certificate files. ### ``/etc/zabbix/web/certs`` @@ -232,9 +232,9 @@ The volume allows to use custom certificates for SAML authentification. The volu # The image variants -The `zabbix-web-apache-pgsql` images come in many flavors, each designed for a specific use case. +The `zabbix-web-nginx-pgsql` images come in many flavors, each designed for a specific use case. -## `zabbix-web-apache-pgsql:alpine-` +## `zabbix-web-nginx-pgsql:alpine-` This image is based on the popular [Alpine Linux project](http://alpinelinux.org), available in [the `alpine` official image](https://hub.docker.com/_/alpine). Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general. @@ -242,11 +242,11 @@ This variant is highly recommended when final image size being as small as possi To minimize image size, it's uncommon for additional related tools (such as `git` or `bash`) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the [`alpine` image description](https://hub.docker.com/_/alpine/) for examples of how to install packages if you are unfamiliar). -## `zabbix-web-apache-pgsql:ubuntu-` +## `zabbix-web-nginx-pgsql:ubuntu-` This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of. -## `zabbix-web-apache-pgsql:ol-` +## `zabbix-web-nginx-pgsql:ol-` Oracle Linux is an open-source operating system available under the GNU General Public License (GPLv2). Suitable for general purpose or Oracle workloads, it benefits from rigorous testing of more than 128,000 hours per day with real-world workloads and includes unique innovations such as Ksplice for zero-downtime kernel patching, DTrace for real-time diagnostics, the powerful Btrfs file system, and more. @@ -262,7 +262,7 @@ Please see [the Docker installation documentation](https://docs.docker.com/insta ## Documentation -Documentation for this image is stored in the [`web-apache-pgsql/` directory](https://github.com/zabbix/zabbix-docker/tree/3.0/web-apache-pgsql) of the [`zabbix/zabbix-docker` GitHub repo](https://github.com/zabbix/zabbix-docker/). Be sure to familiarize yourself with the [repository's `README.md` file](https://github.com/zabbix/zabbix-docker/blob/master/README.md) before attempting a pull request. +Documentation for this image is stored in the [`web-nginx-pgsql/` directory](https://github.com/zabbix/zabbix-docker/tree/3.0/web-nginx-pgsql) of the [`zabbix/zabbix-docker` GitHub repo](https://github.com/zabbix/zabbix-docker/). Be sure to familiarize yourself with the [repository's `README.md` file](https://github.com/zabbix/zabbix-docker/blob/master/README.md) before attempting a pull request. ## Issues diff --git a/Dockerfiles/web-nginx-pgsql/ubuntu/Dockerfile b/Dockerfiles/web-nginx-pgsql/ubuntu/Dockerfile index 72e334288..bfe911ee2 100644 --- a/Dockerfiles/web-nginx-pgsql/ubuntu/Dockerfile +++ b/Dockerfiles/web-nginx-pgsql/ubuntu/Dockerfile @@ -1,14 +1,34 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=5.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.16 +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ubuntu-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM ubuntu:focal +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix web-interface (Nginx, PostgreSQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Nginx web server with PostgreSQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] + RUN set -eux && \ echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d && \ groupadd --system --gid 1995 zabbix && \ @@ -44,7 +64,8 @@ RUN set -eux && \ DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CODENAME') && \ echo "deb https://nginx.org/packages/ubuntu/ $DISTRIB_CODENAME nginx" >> /etc/apt/sources.list.d/nginx.list && \ apt-get -y update && \ - DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \ + DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends \ + -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install \ curl \ nginx \ locales \ @@ -62,38 +83,11 @@ RUN set -eux && \ rm -rf /var/cache/nginx/ && \ rm -f /etc/php/7.4/fpm/pool.d/www.conf && \ ln -sf /dev/fd/2 /var/log/nginx/error.log && \ + rm -f /etc/php/7.4/fpm/php-fpm.conf.dpkg-dist && \ DEBIAN_FRONTEND=noninteractive apt-get -y purge gpg dirmngr gpg-agent && \ - apt-get -y autoremove && \ - apt-get -y clean && \ - rm -rf /var/lib/apt/lists/* - -ARG MAJOR_VERSION=5.0 -ARG ZBX_VERSION=${MAJOR_VERSION}.16 -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - apt-get -y update && \ - DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \ - gettext \ - git && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \ rm -rf tests && \ - rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \ ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php" && \ ln -s "/etc/zabbix/web/maintenance.inc.php" "/usr/share/zabbix/conf/maintenance.inc.php" && \ mkdir -p /var/lib/locales/supported.d/ && \ @@ -104,9 +98,9 @@ RUN set -eux && \ dpkg-reconfigure locales && \ find /usr/share/zabbix/locale -name '*.po' | xargs rm -f && \ find /usr/share/zabbix/locale -name '*.sh' | xargs rm -f && \ - chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/modules/ && \ - chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/modules/ && \ - chmod -R g=u /etc/zabbix/ /usr/share/zabbix/modules/ && \ + chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ + chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ + chmod -R g=u /etc/zabbix/ /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/modules/ && \ chown --quiet -R zabbix:root /etc/nginx/ /etc/php/7.4/fpm/php-fpm.conf /etc/php/7.4/fpm/pool.d/ && \ chgrp -R 0 /etc/nginx/ /etc/php/7.4/fpm/php-fpm.conf /etc/php/7.4/fpm/pool.d/ && \ chmod -R g=u /etc/nginx/ /etc/php/7.4/fpm/php-fpm.conf /etc/php/7.4/fpm/pool.d/ && \ @@ -116,9 +110,6 @@ RUN set -eux && \ chown --quiet -R zabbix:root /usr/share/zabbix/include/defines.inc.php && \ chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \ chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \ - DEBIAN_FRONTEND=noninteractive apt-get -y purge \ - gettext \ - git && \ apt-get -y autoremove && \ apt-get -y clean && \ rm -rf /var/lib/apt/lists/* diff --git a/Dockerfiles/zabbix-appliance/rhel/README.md b/Dockerfiles/zabbix-appliance/rhel/README.md index ec9c538f9..46f39ede7 100644 --- a/Dockerfiles/zabbix-appliance/rhel/README.md +++ b/Dockerfiles/zabbix-appliance/rhel/README.md @@ -17,7 +17,7 @@ Zabbix appliance contains MySQL database server, Zabbix server, Zabbix Java Gate These are the only official Zabbix appliance Docker images. They are based on Red Hat Enterprise Linux 8 images. The available versions of Zabbix appliance are: Zabbix appliance 5.0 - Zabbix appliance 5.2 + Zabbix appliance 6.0 Images are updated when new releases are published. The image with ``latest`` tag is based on Red Hat Enterprise Linux 8. @@ -98,8 +98,8 @@ The varable is PHP ``upload_max_filesize`` option. By default, value is `2M`. The varable is PHP ``max_input_time`` option. By default, value is `300`. ### `ZBX_SESSION_NAME` - -The variable is Zabbix frontend [definition](https://www.zabbix.com/documentation/4.2/manual/web_interface/definitions). String used as the name of the Zabbix frontend session cookie. By default, value is `zbx_sessionid`. + +The variable is Zabbix frontend [definition](https://www.zabbix.com/documentation/current/manual/web_interface/definitions). String used as the name of the Zabbix frontend session cookie. By default, value is `zbx_sessionid`. ### Other variables diff --git a/Dockerfiles/zabbix-appliance/rhel/conf/usr/sbin/zabbix_java_gateway b/Dockerfiles/zabbix-appliance/rhel/conf/usr/sbin/zabbix_java_gateway index e77d407f6..00bab5546 100755 --- a/Dockerfiles/zabbix-appliance/rhel/conf/usr/sbin/zabbix_java_gateway +++ b/Dockerfiles/zabbix-appliance/rhel/conf/usr/sbin/zabbix_java_gateway @@ -1,26 +1,34 @@ + JAVA=${JAVA:-"/usr/bin/java"} -DAEMON=${DAEMON:-"/usr/sbin/zabbix_java"} JAVA_OPTIONS="-server $JAVA_OPTIONS" JAVA_OPTIONS="$JAVA_OPTIONS -Dlogback.configurationFile=/etc/zabbix/zabbix_java_gateway_logback.xml" -cd $DAEMON +cd /usr/sbin/zabbix_java -CLASSPATH="$DAEMON/lib" +CLASSPATH="lib" for jar in `find lib bin ext_lib -name "*.jar"`; do - if [ $jar != *junit* ]; then - CLASSPATH="$CLASSPATH:$DAEMON/$jar" - fi + CLASSPATH="$CLASSPATH:$jar" done -ZABBIX_OPTIONS="" +if [ -n "$ZBX_LISTEN_IP" ]; then + ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.listenIP=$ZBX_LISTEN_IP" +fi +if [ -n "$ZBX_LISTEN_PORT" ]; then + ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.listenPort=$ZBX_LISTEN_PORT" +fi if [ -n "$ZBX_START_POLLERS" ]; then ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.startPollers=$ZBX_START_POLLERS" fi if [ -n "$ZBX_TIMEOUT" ]; then - ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.timeout=$ZBX_TIMEOUT -Dsun.rmi.transport.tcp.responseTimeout=${ZBX_TIMEOUT}000" + ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.timeout=$ZBX_TIMEOUT" +fi +if [ -n "$ZBX_PROPERTIES_FILE" ]; then + ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.propertiesFile=$ZBX_PROPERTIES_FILE" fi +tcp_timeout=${ZBX_TIMEOUT:=3}000 +ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dsun.rmi.transport.tcp.responseTimeout=$tcp_timeout" COMMAND_LINE="$JAVA $JAVA_OPTIONS -classpath $CLASSPATH $ZABBIX_OPTIONS com.zabbix.gateway.JavaGateway" diff --git a/Dockerfiles/zabbix-appliance/rhel/docker-entrypoint.sh b/Dockerfiles/zabbix-appliance/rhel/docker-entrypoint.sh index 426ddf1df..f5d223d50 100755 --- a/Dockerfiles/zabbix-appliance/rhel/docker-entrypoint.sh +++ b/Dockerfiles/zabbix-appliance/rhel/docker-entrypoint.sh @@ -13,13 +13,13 @@ fi # Used only by Zabbix web-interface : ${ZBX_SERVER_NAME:="Zabbix docker"} -# Default timezone for web interface -: ${PHP_TZ:="Europe/Riga"} - # Default MySQL instance location : ${DB_SERVER_HOST:="localhost"} : ${DB_SERVER_PORT:="3306"} +# Default timezone for web interface +: ${PHP_TZ:="Europe/Riga"} + # Default directories # User 'zabbix' home directory ZABBIX_USER_HOME_DIR="/var/lib/zabbix" @@ -539,7 +539,7 @@ prepare_zbx_web_config() { echo "listen.group = nginx" >> "$PHP_CONFIG_FILE" fi - ZBX_DENY_GUI_ACCESS=${ZBX_DENY_GUI_ACCESS:-"false"} + : ${ZBX_DENY_GUI_ACCESS:="false"} export ZBX_DENY_GUI_ACCESS=${ZBX_DENY_GUI_ACCESS,,} export ZBX_GUI_ACCESS_IP_RANGE=${ZBX_GUI_ACCESS_IP_RANGE:-"['127.0.0.1']"} export ZBX_GUI_WARNING_MSG=${ZBX_GUI_WARNING_MSG:-"Zabbix is under maintenance."} @@ -549,7 +549,7 @@ prepare_zbx_web_config() { export ZBX_POSTMAXSIZE=${ZBX_POSTMAXSIZE:-"16M"} export ZBX_UPLOADMAXFILESIZE=${ZBX_UPLOADMAXFILESIZE:-"2M"} export ZBX_MAXINPUTTIME=${ZBX_MAXINPUTTIME:-"300"} - export PHP_TZ=${PHP_TZ:-"Europe/Riga"} + export PHP_TZ=${PHP_TZ} export DB_SERVER_TYPE="MYSQL" export DB_SERVER_HOST=${DB_SERVER_HOST} @@ -562,15 +562,15 @@ prepare_zbx_web_config() { export ZBX_SERVER_PORT="10051" export ZBX_SERVER_NAME=${ZBX_SERVER_NAME} - ZBX_DB_ENCRYPTION=${ZBX_DB_ENCRYPTION:-"false"} + : ${ZBX_DB_ENCRYPTION:-"false"} export ZBX_DB_ENCRYPTION=${ZBX_DB_ENCRYPTION,,} export ZBX_DB_KEY_FILE=${ZBX_DB_KEY_FILE} export ZBX_DB_CERT_FILE=${ZBX_DB_CERT_FILE} export ZBX_DB_CA_FILE=${ZBX_DB_CA_FILE} - ZBX_DB_VERIFY_HOST=${ZBX_DB_VERIFY_HOST:-"false"} + : ${ZBX_DB_VERIFY_HOST:="false"} export ZBX_DB_VERIFY_HOST=${ZBX_DB_VERIFY_HOST,,} - DB_DOUBLE_IEEE754=${DB_DOUBLE_IEEE754:-"true"} + : ${DB_DOUBLE_IEEE754:="true"} export DB_DOUBLE_IEEE754=${DB_DOUBLE_IEEE754,,} export ZBX_HISTORYSTORAGEURL=${ZBX_HISTORYSTORAGEURL} @@ -595,7 +595,7 @@ prepare_zbx_web_config() { "$ZABBIX_ETC_DIR/nginx_ssl.conf" fi - ENABLE_WEB_ACCESS_LOG=${ENABLE_WEB_ACCESS_LOG:-"true"} + : ${ENABLE_WEB_ACCESS_LOG:="true"} if [ "${ENABLE_WEB_ACCESS_LOG,,}" == "false" ]; then sed -ri \ diff --git a/README.md b/README.md index f34c098f3..fd1eef448 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ ![logo](https://assets.zabbix.com/img/logo/zabbix_logo_500x131.png) -![CI](https://github.com/zabbix/zabbix-docker/workflows/CI/badge.svg?branch=5.0&event=release) -![CI](https://github.com/zabbix/zabbix-docker/workflows/CI/badge.svg?branch=5.0&event=push) +[![Build images (DockerHub)](https://github.com/zabbix/zabbix-docker/actions/workflows/images_build.yml/badge.svg?branch=5.0&event=release)](https://github.com/zabbix/zabbix-docker/actions/workflows/images_build.yml) +[![Build images (DockerHub)](https://github.com/zabbix/zabbix-docker/actions/workflows/images_build.yml/badge.svg?branch=5.0&event=push)](https://github.com/zabbix/zabbix-docker/actions/workflows/images_build.yml) + +[![Build images (DockerHub, Windows)](https://github.com/zabbix/zabbix-docker/actions/workflows/images_build_windows.yml/badge.svg?branch=5.0&event=release)](https://github.com/zabbix/zabbix-docker/actions/workflows/images_build_windows.yml) +[![Build images (DockerHub, Windows)](https://github.com/zabbix/zabbix-docker/actions/workflows/images_build_windows.yml/badge.svg?branch=5.0&event=push)](https://github.com/zabbix/zabbix-docker/actions/workflows/images_build_windows.yml) # What is Zabbix? diff --git a/build.json b/build.json new file mode 100644 index 000000000..6be69b6f5 --- /dev/null +++ b/build.json @@ -0,0 +1,41 @@ +{ + "os-linux": { + "alpine": [ + "linux/amd64", + "linux/arm/v6", + "linux/arm/v7", + "linux/arm64" + ], + "ol": [ + "linux/amd64", + "linux/arm64" + ], + "ubuntu": [ + "linux/amd64", + "linux/arm/v7", + "linux/arm64" + ], + "centos": [ + "linux/amd64", + "linux/arm64" + ] + }, + "os-windows": { + "windows-2022": "ltsc2022", + "windows-2019": "ltsc2019" + }, + "components": { + "agent": "build-mysql", + "agent2": "build-mysql", + "java-gateway": "build-mysql", + "proxy-mysql": "build-mysql", + "proxy-sqlite3": "build-sqlite3", + "server-mysql": "build-mysql", + "server-pgsql": "build-pgsql", + "snmptraps": "", + "web-apache-mysql": "build-mysql", + "web-apache-pgsql": "build-pgsql", + "web-nginx-mysql": "build-mysql", + "web-nginx-pgsql": "build-mysql" + } +} \ No newline at end of file diff --git a/docker-compose_v3_alpine_mysql_local.yaml b/docker-compose_v3_alpine_mysql_local.yaml index 9fc0b284f..9f3e87bec 100644 --- a/docker-compose_v3_alpine_mysql_local.yaml +++ b/docker-compose_v3_alpine_mysql_local.yaml @@ -1,10 +1,41 @@ version: '3.5' services: + zabbix-build-base: + build: + context: ./Dockerfiles/build-base/alpine + cache_from: + - alpine:3.12 + image: zabbix-build-base:alpine-local + + zabbix-build-mysql: + build: + context: ./Dockerfiles/build-mysql/alpine + cache_from: + - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-base:alpine-local + image: zabbix-build-mysql:alpine-local + depends_on: + - zabbix-build-base + + zabbix-build-sqlite3: + build: + context: ./Dockerfiles/build-sqlite3/alpine + cache_from: + - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-base:alpine-local + image: zabbix-build-sqlite3:alpine-local + depends_on: + - zabbix-build-base + zabbix-server: build: context: ./Dockerfiles/server-mysql/alpine cache_from: - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:alpine-local image: zabbix-server-mysql:alpine-local ports: - "10051:10051" @@ -44,6 +75,7 @@ services: # - root-ca.pem depends_on: - mysql-server + - zabbix-build-mysql networks: zbx_net_backend: aliases: @@ -72,6 +104,8 @@ services: context: ./Dockerfiles/proxy-sqlite3/alpine cache_from: - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-sqlite3:alpine-local image: zabbix-proxy-sqlite3:alpine-local profiles: - all @@ -105,6 +139,7 @@ services: depends_on: - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-sqlite3 networks: zbx_net_backend: aliases: @@ -125,6 +160,8 @@ services: context: ./Dockerfiles/proxy-mysql/alpine cache_from: - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:alpine-local image: zabbix-proxy-mysql:alpine-local profiles: - all @@ -160,6 +197,7 @@ services: - mysql-server - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -187,6 +225,8 @@ services: context: ./Dockerfiles/web-apache-mysql/alpine cache_from: - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:alpine-local image: zabbix-web-apache-mysql:alpine-local profiles: - all @@ -218,6 +258,7 @@ services: depends_on: - mysql-server - zabbix-server + - zabbix-build-mysql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -247,6 +288,8 @@ services: context: ./Dockerfiles/web-nginx-mysql/alpine cache_from: - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:alpine-local image: zabbix-web-nginx-mysql:alpine-local ports: - "80:8080" @@ -276,6 +319,7 @@ services: depends_on: - mysql-server - zabbix-server + - zabbix-build-mysql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -305,7 +349,11 @@ services: context: ./Dockerfiles/agent/alpine cache_from: - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:alpine-local image: zabbix-agent:alpine-local + deploy: + mode: global profiles: - full - all @@ -331,6 +379,8 @@ services: - ./env_vars/.env_agent privileged: true pid: "host" + depends_on: + - zabbix-build-mysql networks: zbx_net_backend: aliases: @@ -349,6 +399,8 @@ services: context: ./Dockerfiles/java-gateway/alpine cache_from: - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:alpine-local image: zabbix-java-gateway:alpine-local profiles: - full @@ -365,6 +417,8 @@ services: memory: 256M env_file: - ./env_vars/.env_java + depends_on: + - zabbix-build-mysql networks: zbx_net_backend: aliases: diff --git a/docker-compose_v3_alpine_pgsql_latest.yaml b/docker-compose_v3_alpine_pgsql_latest.yaml index d888484da..fad7896d2 100644 --- a/docker-compose_v3_alpine_pgsql_latest.yaml +++ b/docker-compose_v3_alpine_pgsql_latest.yaml @@ -404,9 +404,9 @@ services: # command: -c ssl=on -c ssl_cert_file=/run/secrets/server-cert.pem -c ssl_key_file=/run/secrets/server-key.pem -c ssl_ca_file=/run/secrets/root-ca.pem volumes: - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw - - ./.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro - - ./.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro - - ./.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro + - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro + - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro + - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro env_file: - ./env_vars/.env_db_pgsql secrets: diff --git a/docker-compose_v3_alpine_pgsql_local.yaml b/docker-compose_v3_alpine_pgsql_local.yaml index 453013c00..91d2a473c 100644 --- a/docker-compose_v3_alpine_pgsql_local.yaml +++ b/docker-compose_v3_alpine_pgsql_local.yaml @@ -1,10 +1,52 @@ version: '3.5' services: + zabbix-build-base: + build: + context: ./Dockerfiles/build-base/alpine + cache_from: + - alpine:3.12 + image: zabbix-build-base:alpine-local + + zabbix-build-pgsql: + build: + context: ./Dockerfiles/build-pgsql/alpine + cache_from: + - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-base:alpine-local + image: zabbix-build-pgsql:alpine-local + depends_on: + - zabbix-build-base + + zabbix-build-mysql: + build: + context: ./Dockerfiles/build-mysql/alpine + cache_from: + - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-base:alpine-local + image: zabbix-build-mysql:alpine-local + depends_on: + - zabbix-build-base + + zabbix-build-sqlite3: + build: + context: ./Dockerfiles/build-sqlite3/alpine + cache_from: + - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-base:alpine-local + image: zabbix-build-sqlite3:alpine-local + depends_on: + - zabbix-build-base + zabbix-server: build: context: ./Dockerfiles/server-pgsql/alpine cache_from: - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:alpine-local image: zabbix-server-pgsql:alpine-local ports: - "10051:10051" @@ -43,6 +85,7 @@ services: - POSTGRES_PASSWORD depends_on: - postgres-server + - zabbix-build-pgsql networks: zbx_net_backend: aliases: @@ -71,6 +114,8 @@ services: context: ./Dockerfiles/proxy-sqlite3/alpine cache_from: - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-sqlite3:alpine-local image: zabbix-proxy-sqlite3:alpine-local profiles: - all @@ -104,6 +149,7 @@ services: depends_on: - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-sqlite3 networks: zbx_net_backend: aliases: @@ -124,6 +170,8 @@ services: context: ./Dockerfiles/proxy-mysql/alpine cache_from: - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:alpine-local image: zabbix-proxy-mysql:alpine-local profiles: - all @@ -163,6 +211,7 @@ services: - mysql-server - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-mysql networks: zbx_net_backend: aliases: @@ -183,6 +232,8 @@ services: context: ./Dockerfiles/web-apache-pgsql/alpine cache_from: - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:alpine-local image: zabbix-web-apache-pgsql:alpine-local profiles: - all @@ -214,6 +265,7 @@ services: depends_on: - postgres-server - zabbix-server + - zabbix-build-pgsql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -243,6 +295,8 @@ services: context: ./Dockerfiles/web-nginx-pgsql/alpine cache_from: - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:alpine-local image: zabbix-web-nginx-pgsql:alpine-local ports: - "80:8080" @@ -272,6 +326,7 @@ services: depends_on: - postgres-server - zabbix-server + - zabbix-build-pgsql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -301,6 +356,8 @@ services: context: ./Dockerfiles/agent/alpine cache_from: - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:alpine-local image: zabbix-agent:alpine-local profiles: - full @@ -327,6 +384,8 @@ services: - ./env_vars/.env_agent privileged: true pid: "host" + depends_on: + - zabbix-build-pgsql networks: zbx_net_backend: aliases: @@ -345,6 +404,8 @@ services: context: ./Dockerfiles/java-gateway/alpine cache_from: - alpine:3.12 + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:alpine-local image: zabbix-java-gateway:alpine-local profiles: - full @@ -361,6 +422,8 @@ services: memory: 256M env_file: - ./env_vars/.env_java + depends_on: + - zabbix-build-pgsql networks: zbx_net_backend: aliases: diff --git a/docker-compose_v3_centos_mysql_local.yaml b/docker-compose_v3_centos_mysql_local.yaml index f772df318..fdb25fd8a 100644 --- a/docker-compose_v3_centos_mysql_local.yaml +++ b/docker-compose_v3_centos_mysql_local.yaml @@ -1,10 +1,41 @@ version: '3.5' services: + zabbix-build-base: + build: + context: ./Dockerfiles/build-base/centos + cache_from: + - centos:centos8 + image: zabbix-build-base:centos-local + + zabbix-build-mysql: + build: + context: ./Dockerfiles/build-mysql/centos + cache_from: + - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-base:centos-local + image: zabbix-build-mysql:centos-local + depends_on: + - zabbix-build-base + + zabbix-build-sqlite3: + build: + context: ./Dockerfiles/build-sqlite3/centos + cache_from: + - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-base:centos-local + image: zabbix-build-sqlite3:centos-local + depends_on: + - zabbix-build-base + zabbix-server: build: context: ./Dockerfiles/server-mysql/centos cache_from: - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:centos-local image: zabbix-server-mysql:centos-local ports: - "10051:10051" @@ -44,6 +75,7 @@ services: # - root-ca.pem depends_on: - mysql-server + - zabbix-build-mysql networks: zbx_net_backend: aliases: @@ -72,6 +104,8 @@ services: context: ./Dockerfiles/proxy-sqlite3/centos cache_from: - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-sqlite3:centos-local image: zabbix-proxy-sqlite3:centos-local profiles: - all @@ -105,6 +139,7 @@ services: depends_on: - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-sqlite3 networks: zbx_net_backend: aliases: @@ -125,6 +160,8 @@ services: context: ./Dockerfiles/proxy-mysql/centos cache_from: - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:centos-local image: zabbix-proxy-mysql:centos-local profiles: - all @@ -160,6 +197,7 @@ services: - mysql-server - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -187,6 +225,8 @@ services: context: ./Dockerfiles/web-apache-mysql/centos cache_from: - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:centos-local image: zabbix-web-apache-mysql:centos-local profiles: - all @@ -218,6 +258,7 @@ services: depends_on: - mysql-server - zabbix-server + - zabbix-build-mysql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -247,6 +288,8 @@ services: context: ./Dockerfiles/web-nginx-mysql/centos cache_from: - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:centos-local image: zabbix-web-nginx-mysql:centos-local ports: - "80:8080" @@ -276,6 +319,7 @@ services: depends_on: - mysql-server - zabbix-server + - zabbix-build-mysql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -305,6 +349,8 @@ services: context: ./Dockerfiles/agent/centos cache_from: - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:centos-local image: zabbix-agent:centos-local profiles: - full @@ -331,6 +377,8 @@ services: - ./env_vars/.env_agent privileged: true pid: "host" + depends_on: + - zabbix-build-mysql networks: zbx_net_backend: aliases: @@ -349,6 +397,8 @@ services: context: ./Dockerfiles/java-gateway/centos cache_from: - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:centos-local image: zabbix-java-gateway:centos-local profiles: - full @@ -365,6 +415,8 @@ services: memory: 256M env_file: - ./env_vars/.env_java + depends_on: + - zabbix-build-mysql networks: zbx_net_backend: aliases: diff --git a/docker-compose_v3_centos_pgsql_local.yaml b/docker-compose_v3_centos_pgsql_local.yaml index 9c1d714c3..2be0ce7a2 100644 --- a/docker-compose_v3_centos_pgsql_local.yaml +++ b/docker-compose_v3_centos_pgsql_local.yaml @@ -1,10 +1,52 @@ version: '3.5' services: + zabbix-build-base: + build: + context: ./Dockerfiles/build-base/centos + cache_from: + - centos:centos8 + image: zabbix-build-base:centos-local + + zabbix-build-pgsql: + build: + context: ./Dockerfiles/build-pgsql/centos + cache_from: + - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-base:centos-local + image: zabbix-build-pgsql:centos-local + depends_on: + - zabbix-build-base + + zabbix-build-mysql: + build: + context: ./Dockerfiles/build-mysql/centos + cache_from: + - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-base:centos-local + image: zabbix-build-mysql:centos-local + depends_on: + - zabbix-build-base + + zabbix-build-sqlite3: + build: + context: ./Dockerfiles/build-sqlite3/centos + cache_from: + - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-base:centos-local + image: zabbix-build-sqlite3:centos-local + depends_on: + - zabbix-build-base + zabbix-server: build: context: ./Dockerfiles/server-pgsql/centos cache_from: - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:centos-local image: zabbix-server-pgsql:centos-local ports: - "10051:10051" @@ -43,6 +85,7 @@ services: - POSTGRES_PASSWORD depends_on: - postgres-server + - zabbix-build-pgsql networks: zbx_net_backend: aliases: @@ -71,6 +114,8 @@ services: context: ./Dockerfiles/proxy-sqlite3/centos cache_from: - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:centos-local image: zabbix-proxy-sqlite3:centos-local profiles: - all @@ -104,6 +149,7 @@ services: depends_on: - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-pgsql networks: zbx_net_backend: aliases: @@ -124,6 +170,8 @@ services: context: ./Dockerfiles/proxy-mysql/centos cache_from: - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:centos-local image: zabbix-proxy-mysql:centos-local profiles: - all @@ -163,6 +211,7 @@ services: - mysql-server - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-mysql networks: zbx_net_backend: aliases: @@ -183,6 +232,8 @@ services: context: ./Dockerfiles/web-apache-pgsql/centos cache_from: - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:centos-local image: zabbix-web-apache-pgsql:centos-local profiles: - all @@ -214,6 +265,7 @@ services: depends_on: - postgres-server - zabbix-server + - zabbix-build-pgsql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -243,6 +295,8 @@ services: context: ./Dockerfiles/web-nginx-pgsql/centos cache_from: - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:centos-local image: zabbix-web-nginx-pgsql:centos-local ports: - "80:8080" @@ -272,6 +326,7 @@ services: depends_on: - postgres-server - zabbix-server + - zabbix-build-pgsql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -301,6 +356,8 @@ services: context: ./Dockerfiles/agent/centos cache_from: - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:centos-local image: zabbix-agent:centos-local profiles: - full @@ -327,6 +384,8 @@ services: - ./env_vars/.env_agent privileged: true pid: "host" + depends_on: + - zabbix-build-pgsql networks: zbx_net_backend: aliases: @@ -345,6 +404,8 @@ services: context: ./Dockerfiles/java-gateway/centos cache_from: - centos:centos8 + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:centos-local image: zabbix-java-gateway:centos-local profiles: - full @@ -361,6 +422,8 @@ services: memory: 256M env_file: - ./env_vars/.env_java + depends_on: + - zabbix-build-pgsql networks: zbx_net_backend: aliases: diff --git a/docker-compose_v3_ol_mysql_local.yaml b/docker-compose_v3_ol_mysql_local.yaml index 9fbb3ffee..1bfd0ed37 100644 --- a/docker-compose_v3_ol_mysql_local.yaml +++ b/docker-compose_v3_ol_mysql_local.yaml @@ -1,10 +1,41 @@ version: '3.5' services: + zabbix-build-base: + build: + context: ./Dockerfiles/build-base/ol + cache_from: + - oraclelinux:8-slim + image: zabbix-build-base:ol-local + + zabbix-build-mysql: + build: + context: ./Dockerfiles/build-mysql/ol + cache_from: + - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-base:ol-local + image: zabbix-build-mysql:ol-local + depends_on: + - zabbix-build-base + + zabbix-build-sqlite3: + build: + context: ./Dockerfiles/build-sqlite3/ol + cache_from: + - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-base:ol-local + image: zabbix-build-sqlite3:ol-local + depends_on: + - zabbix-build-base + zabbix-server: build: context: ./Dockerfiles/server-mysql/ol cache_from: - - oraclelinux:8 + - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local image: zabbix-server-mysql:ol-local ports: - "10051:10051" @@ -44,6 +75,7 @@ services: # - root-ca.pem depends_on: - mysql-server + - zabbix-build-mysql networks: zbx_net_backend: aliases: @@ -71,7 +103,9 @@ services: build: context: ./Dockerfiles/proxy-sqlite3/ol cache_from: - - oraclelinux:8 + - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-sqlite3:ol-local image: zabbix-proxy-sqlite3:ol-local profiles: - all @@ -105,6 +139,7 @@ services: depends_on: - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-sqlite3 networks: zbx_net_backend: aliases: @@ -124,7 +159,9 @@ services: build: context: ./Dockerfiles/proxy-mysql/ol cache_from: - - oraclelinux:8 + - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local image: zabbix-proxy-mysql:ol-local profiles: - all @@ -160,6 +197,7 @@ services: - mysql-server - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -186,7 +224,9 @@ services: build: context: ./Dockerfiles/web-apache-mysql/ol cache_from: - - oraclelinux:8 + - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local image: zabbix-web-apache-mysql:ol-local profiles: - all @@ -218,6 +258,7 @@ services: depends_on: - mysql-server - zabbix-server + - zabbix-build-mysql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -246,7 +287,9 @@ services: build: context: ./Dockerfiles/web-nginx-mysql/ol cache_from: - - oraclelinux:8 + - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local image: zabbix-web-nginx-mysql:ol-local ports: - "80:8080" @@ -276,6 +319,7 @@ services: depends_on: - mysql-server - zabbix-server + - zabbix-build-mysql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -304,7 +348,9 @@ services: build: context: ./Dockerfiles/agent/ol cache_from: - - oraclelinux:8 + - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local image: zabbix-agent:ol-local profiles: - full @@ -331,6 +377,8 @@ services: - ./env_vars/.env_agent privileged: true pid: "host" + depends_on: + - zabbix-build-mysql networks: zbx_net_backend: aliases: @@ -348,7 +396,9 @@ services: build: context: ./Dockerfiles/java-gateway/ol cache_from: - - oraclelinux:8 + - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local image: zabbix-java-gateway:ol-local profiles: - full @@ -365,6 +415,8 @@ services: memory: 256M env_file: - ./env_vars/.env_java + depends_on: + - zabbix-build-mysql networks: zbx_net_backend: aliases: @@ -381,7 +433,7 @@ services: build: context: ./Dockerfiles/snmptraps/ol cache_from: - - oraclelinux:8 + - oraclelinux:8-slim image: zabbix-snmptraps:ol-local profiles: - full diff --git a/docker-compose_v3_ol_pgsql_local.yaml b/docker-compose_v3_ol_pgsql_local.yaml index a2d1f8ac4..caeb332c6 100644 --- a/docker-compose_v3_ol_pgsql_local.yaml +++ b/docker-compose_v3_ol_pgsql_local.yaml @@ -1,10 +1,52 @@ version: '3.5' services: + zabbix-build-base: + build: + context: ./Dockerfiles/build-base/ol + cache_from: + - oraclelinux:8-slim + image: zabbix-build-base:ol-local + + zabbix-build-pgsql: + build: + context: ./Dockerfiles/build-pgsql/ol + cache_from: + - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-base:ol-local + image: zabbix-build-pgsql:ol-local + depends_on: + - zabbix-build-base + + zabbix-build-mysql: + build: + context: ./Dockerfiles/build-mysql/ol + cache_from: + - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-base:ol-local + image: zabbix-build-mysql:ol-local + depends_on: + - zabbix-build-base + + zabbix-build-sqlite3: + build: + context: ./Dockerfiles/build-sqlite3/ol + cache_from: + - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-base:ol-local + image: zabbix-build-sqlite3:ol-local + depends_on: + - zabbix-build-base + zabbix-server: build: context: ./Dockerfiles/server-pgsql/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:ol-local image: zabbix-server-pgsql:ol-local ports: - "10051:10051" @@ -43,6 +85,7 @@ services: - POSTGRES_PASSWORD depends_on: - postgres-server + - zabbix-build-pgsql networks: zbx_net_backend: aliases: @@ -71,6 +114,8 @@ services: context: ./Dockerfiles/proxy-sqlite3/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-sqlite3:ol-local image: zabbix-proxy-sqlite3:ol-local profiles: - all @@ -104,6 +149,7 @@ services: depends_on: - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-sqlite3 networks: zbx_net_backend: aliases: @@ -124,6 +170,8 @@ services: context: ./Dockerfiles/proxy-mysql/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local image: zabbix-proxy-mysql:ol-local profiles: - all @@ -163,6 +211,7 @@ services: - mysql-server - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-mysql networks: zbx_net_backend: aliases: @@ -183,6 +232,8 @@ services: context: ./Dockerfiles/web-apache-pgsql/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:ol-local image: zabbix-web-apache-pgsql:ol-local profiles: - all @@ -214,6 +265,7 @@ services: depends_on: - postgres-server - zabbix-server + - zabbix-build-pgsql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -243,6 +295,8 @@ services: context: ./Dockerfiles/web-nginx-pgsql/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:ol-local image: zabbix-web-nginx-pgsql:ol-local ports: - "80:8080" @@ -272,6 +326,7 @@ services: depends_on: - postgres-server - zabbix-server + - zabbix-build-pgsql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -301,6 +356,8 @@ services: context: ./Dockerfiles/agent/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:ol-local image: zabbix-agent:ol-local profiles: - full @@ -327,6 +384,8 @@ services: - ./env_vars/.env_agent privileged: true pid: "host" + depends_on: + - zabbix-build-pgsql networks: zbx_net_backend: aliases: @@ -345,6 +404,8 @@ services: context: ./Dockerfiles/java-gateway/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:ol-local image: zabbix-java-gateway:ol-local profiles: - full @@ -361,6 +422,8 @@ services: memory: 256M env_file: - ./env_vars/.env_java + depends_on: + - zabbix-build-pgsql networks: zbx_net_backend: aliases: diff --git a/docker-compose_v3_ubuntu_mysql_local.yaml b/docker-compose_v3_ubuntu_mysql_local.yaml index 84d96e869..22245fc7d 100644 --- a/docker-compose_v3_ubuntu_mysql_local.yaml +++ b/docker-compose_v3_ubuntu_mysql_local.yaml @@ -1,10 +1,41 @@ version: '3.5' services: + zabbix-build-base: + build: + context: ./Dockerfiles/build-base/ubuntu + cache_from: + - ubuntu:focal + image: zabbix-build-base:ubuntu-local + + zabbix-build-mysql: + build: + context: ./Dockerfiles/build-mysql/ubuntu + cache_from: + - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-base:ubuntu-local + image: zabbix-build-mysql:ubuntu-local + depends_on: + - zabbix-build-base + + zabbix-build-sqlite3: + build: + context: ./Dockerfiles/build-sqlite3/ubuntu + cache_from: + - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-base:ubuntu-local + image: zabbix-build-sqlite3:ubuntu-local + depends_on: + - zabbix-build-base + zabbix-server: build: context: ./Dockerfiles/server-mysql/ubuntu cache_from: - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ubuntu-local image: zabbix-server-mysql:ubuntu-local ports: - "10051:10051" @@ -43,6 +74,7 @@ services: # - root-ca.pem depends_on: - mysql-server + - zabbix-build-mysql networks: zbx_net_backend: aliases: @@ -71,6 +103,8 @@ services: context: ./Dockerfiles/proxy-sqlite3/ubuntu cache_from: - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-sqlite3:ubuntu-local image: zabbix-proxy-sqlite3:ubuntu-local profiles: - all @@ -103,6 +137,7 @@ services: depends_on: - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-sqlite3 networks: zbx_net_backend: aliases: @@ -123,6 +158,8 @@ services: context: ./Dockerfiles/proxy-mysql/ubuntu cache_from: - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ubuntu-local image: zabbix-proxy-mysql:ubuntu-local profiles: - all @@ -157,6 +194,7 @@ services: - mysql-server - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -184,6 +222,8 @@ services: context: ./Dockerfiles/web-apache-mysql/ubuntu cache_from: - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ubuntu-local image: zabbix-web-apache-mysql:ubuntu-local profiles: - all @@ -214,6 +254,7 @@ services: depends_on: - mysql-server - zabbix-server + - zabbix-build-mysql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -243,6 +284,8 @@ services: context: ./Dockerfiles/web-nginx-mysql/ubuntu cache_from: - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ubuntu-local image: zabbix-web-nginx-mysql:ubuntu-local ports: - "80:8080" @@ -271,6 +314,7 @@ services: depends_on: - mysql-server - zabbix-server + - zabbix-build-mysql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -300,6 +344,8 @@ services: context: ./Dockerfiles/agent/ubuntu cache_from: - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ubuntu-local image: zabbix-agent:ubuntu-local profiles: - full @@ -325,6 +371,8 @@ services: - ./env_vars/.env_agent privileged: true pid: "host" + depends_on: + - zabbix-build-mysql networks: zbx_net_backend: aliases: @@ -343,6 +391,8 @@ services: context: ./Dockerfiles/java-gateway/ubuntu cache_from: - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ubuntu-local image: zabbix-java-gateway:ubuntu-local profiles: - full @@ -359,6 +409,8 @@ services: memory: 256M env_file: - ./env_vars/.env_java + depends_on: + - zabbix-build-mysql networks: zbx_net_backend: aliases: diff --git a/docker-compose_v3_ubuntu_pgsql_local.yaml b/docker-compose_v3_ubuntu_pgsql_local.yaml index 535d11f8f..0be97fb3c 100644 --- a/docker-compose_v3_ubuntu_pgsql_local.yaml +++ b/docker-compose_v3_ubuntu_pgsql_local.yaml @@ -1,10 +1,52 @@ version: '3.5' services: + zabbix-build-base: + build: + context: ./Dockerfiles/build-base/ubuntu + cache_from: + - ubuntu:focal + image: zabbix-build-base:ubuntu-local + + zabbix-build-pgsql: + build: + context: ./Dockerfiles/build-pgsql/ubuntu + cache_from: + - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-base:ubuntu-local + image: zabbix-build-pgsql:ubuntu-local + depends_on: + - zabbix-build-base + + zabbix-build-mysql: + build: + context: ./Dockerfiles/build-mysql/ubuntu + cache_from: + - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-base:ubuntu-local + image: zabbix-build-mysql:ubuntu-local + depends_on: + - zabbix-build-base + + zabbix-build-sqlite3: + build: + context: ./Dockerfiles/build-sqlite3/ubuntu + cache_from: + - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-base:ubuntu-local + image: zabbix-build-sqlite3:ubuntu-local + depends_on: + - zabbix-build-base + zabbix-server: build: context: ./Dockerfiles/server-pgsql/ubuntu cache_from: - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:ubuntu-local image: zabbix-server-pgsql:ubuntu-local ports: - "10051:10051" @@ -42,6 +84,7 @@ services: - POSTGRES_PASSWORD depends_on: - postgres-server + - zabbix-build-pgsql networks: zbx_net_backend: aliases: @@ -70,6 +113,8 @@ services: context: ./Dockerfiles/proxy-sqlite3/ubuntu cache_from: - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-sqlite3:ubuntu-local image: zabbix-proxy-sqlite3:ubuntu-local profiles: - all @@ -102,6 +147,7 @@ services: depends_on: - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-sqlite3 networks: zbx_net_backend: aliases: @@ -122,6 +168,8 @@ services: context: ./Dockerfiles/proxy-mysql/ubuntu cache_from: - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ubuntu-local image: zabbix-proxy-mysql:ubuntu-local profiles: - all @@ -160,6 +208,7 @@ services: - mysql-server - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-mysql networks: zbx_net_backend: aliases: @@ -180,6 +229,8 @@ services: context: ./Dockerfiles/web-apache-pgsql/ubuntu cache_from: - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:ubuntu-local image: zabbix-web-apache-pgsql:ubuntu-local profiles: - all @@ -210,6 +261,7 @@ services: depends_on: - postgres-server - zabbix-server + - zabbix-build-pgsql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -239,6 +291,8 @@ services: context: ./Dockerfiles/web-nginx-pgsql/ubuntu cache_from: - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:ubuntu-local image: zabbix-web-nginx-pgsql:ubuntu-local ports: - "80:8080" @@ -267,6 +321,7 @@ services: depends_on: - postgres-server - zabbix-server + - zabbix-build-pgsql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -296,6 +351,8 @@ services: context: ./Dockerfiles/agent/ubuntu cache_from: - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:ubuntu-local image: zabbix-agent:ubuntu-local profiles: - full @@ -321,6 +378,8 @@ services: - ./env_vars/.env_agent privileged: true pid: "host" + depends_on: + - zabbix-build-pgsql networks: zbx_net_backend: aliases: @@ -339,6 +398,8 @@ services: context: ./Dockerfiles/java-gateway/ubuntu cache_from: - ubuntu:focal + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:ubuntu-local image: zabbix-java-gateway:ubuntu-local profiles: - full @@ -355,6 +416,8 @@ services: memory: 256M env_file: - ./env_vars/.env_java + depends_on: + - zabbix-build-pgsql networks: zbx_net_backend: aliases: diff --git a/kubernetes.yaml b/kubernetes.yaml index 3918eae66..51aef4fd1 100644 --- a/kubernetes.yaml +++ b/kubernetes.yaml @@ -5,6 +5,42 @@ metadata: labels: name: zabbix --- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: zabbix-agent + namespace: zabbix +rules: +- verbs: + - use + apiGroups: + - security.openshift.io + resources: + - securitycontextconstraints + resourceNames: + - privileged + - hostaccess + - hostnetwork +--- +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: zabbix-agent + namespace: zabbix +subjects: +- kind: ServiceAccount + name: zabbix-agent +roleRef: + kind: Role + name: zabbix-agent + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: zabbix-agent + namespace: zabbix +--- apiVersion: v1 kind: Service metadata: @@ -22,8 +58,8 @@ spec: name: web-https selector: name: zabbix-web - externalIPs: - - + sessionAffinity: None + type: ClusterIP --- apiVersion: v1 kind: Service @@ -59,8 +95,8 @@ spec: name: snmp-trap selector: name: zabbix-server - externalIPs: - - + sessionAffinity: None + type: ClusterIP --- apiVersion: v1 kind: Service @@ -80,6 +116,8 @@ spec: name: snmp-trap selector: name: zabbix-proxy-sqlite3 + sessionAffinity: None + type: ClusterIP --- apiVersion: v1 kind: Service @@ -146,6 +184,10 @@ spec: name: zabbix-web app: zabbix spec: + volumes: + - name: mysql-tls-certs + secret: + secretName: zabbix-mysql-client-tls-certs containers: - name: zabbix-web image: zabbix/zabbix-web-nginx-mysql:alpine-5.0-latest @@ -184,9 +226,11 @@ spec: failureThreshold: 5 env: - name: ZBX_SERVER_NAME - value: "Zabbix kubernetes" + value: "Zabbix Kubernetes" - name: PHP_TZ value: "Europe/Riga" + - name: DB_SERVER_HOST + value: "mysql-server" - name: MYSQL_USER valueFrom: secretKeyRef: @@ -204,17 +248,49 @@ spec: key: db-root-pass - name: MYSQL_DATABASE value: "zabbix" + - name: ZBX_DB_ENCRYPTION + value: "true" + - name: ZBX_DB_CA_FILE + value: "/tmp/secrets/root-ca.pem" + - name: ZBX_DB_CERT_FILE + value: "/tmp/secrets/client-cert.pem" + - name: ZBX_DB_KEY_FILE + value: "/tmp/secrets/client-key.pem" + - name: ZBX_DB_VERIFY_HOST + value: "false" + - name: ZBX_DB_CIPHER_LIST + value: "" +# - name: ZBX_HISTORYSTORAGEURL +# value: "" +# - name: ZBX_HISTORYSTORAGETYPES +# value: "" +# - name: ZBX_MAXEXECUTIONTIME +# value: "" +# - name: ZBX_MEMORYLIMIT +# value: "" +# - name: ZBX_POSTMAXSIZE +# value: "" +# - name: ZBX_UPLOADMAXFILESIZE +# value: "" +# - name: ZBX_MAXINPUTTIME +# value: "" +# - name: ZBX_SESSION_NAME +# value: "" +# - name: DB_DOUBLE_IEEE754 +# value: "true" + - name: ZBX_SSO_SETTINGS + value: "[]" + - name: ENABLE_WEB_ACCESS_LOG + value: "true" + - name: DEBUG_MODE + value: "false" volumeMounts: - - name: zabbix-web-ssl - mountPath: /etc/ssl/nginx + - mountPath: "/tmp/secrets" + name: mysql-tls-certs readOnly: true - volumes: - - hostPath: - path: ./zbx_env/etc/ssl/nginx/ - name: zabbix-web-ssl --- -apiVersion: v1 -kind: ReplicationController +apiVersion: apps/v1 +kind: Deployment metadata: name: mysql-server labels: @@ -222,7 +298,13 @@ metadata: tier: mysql-server namespace: zabbix spec: - replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + name: mysql-server + app: zabbix + tier: mysql-server template: metadata: labels: @@ -234,12 +316,38 @@ spec: - name: zabbix-mysql-data persistentVolumeClaim: claimName: zabbix-mysql-data-claim + - name: mysql-tls-certs + secret: + secretName: zabbix-mysql-server-tls-certs containers: - name: zabbix-db - image: mysql:5.7 + image: mysql:8.0 + args: + - mysqld + - --character-set-server=utf8 + - --collation-server=utf8_bin + - --default-authentication-plugin=mysql_native_password + - --require-secure-transport + - --ssl-ca=/tmp/secrets/root-ca.pem + - --ssl-cert=/tmp/secrets/server-cert.pem + - --ssl-key=/tmp/secrets/server-key.pem + - --tls-version=TLSv1.2,TLSv1.3 ports: - containerPort: 3306 name: mysql + livenessProbe: + exec: + command: ["bash", "-c", "mysqladmin -u root -p$MYSQL_ROOT_PASSWORD ping"] + timeoutSeconds: 3 + failureThreshold: 3 + periodSeconds: 10 + startupProbe: + exec: + command: ["bash", "-c", "mysql -u root -p$MYSQL_ROOT_PASSWORD -e 'SELECT 1'"] + initialDelaySeconds: 5 + periodSeconds: 5 + timeoutSeconds: 3 + failureThreshold: 30 env: - name: MYSQL_USER valueFrom: @@ -259,12 +367,18 @@ spec: - name: MYSQL_DATABASE value: "zabbix" volumeMounts: - - mountPath: "/var/lib/mysql/" + - mountPath: "/var/lib/mysql" name: zabbix-mysql-data readOnly: false + - mountPath: "/tmp/secrets" + name: mysql-tls-certs + readOnly: true + securityContext: + capabilities: {} + privileged: false --- -apiVersion: v1 -kind: ReplicationController +apiVersion: apps/v1 +kind: Deployment metadata: name: zabbix-server labels: @@ -273,13 +387,25 @@ metadata: environment: dev namespace: zabbix spec: - replicas: 1 + strategy: + type: Recreate + rollingUpdate: null + selector: + matchLabels: + name: zabbix-server + app: zabbix template: metadata: labels: name: zabbix-server app: zabbix spec: + volumes: + - name: zabbix-snmptraps + emptyDir: {} + - name: mysql-tls-certs + secret: + secretName: zabbix-mysql-client-tls-certs containers: - name: zabbix-server image: zabbix/zabbix-server-mysql:alpine-5.0-latest @@ -316,38 +442,175 @@ spec: key: db-root-pass - name: MYSQL_DATABASE value: "zabbix" + - name: ZBX_DBTLSCONNECT + value: "required" + - name: ZBX_DBTLSCAFILE + value: "/tmp/secrets/root-ca.pem" + - name: ZBX_DBTLSCERTFILE + value: "/tmp/secrets/client-cert.pem" + - name: ZBX_DBTLSKEYFILE + value: "/tmp/secrets/client-key.pem" + - name: ZBX_DBTLSCIPHER + value: "" + - name: ZBX_DBTLSCIPHER13 + value: "" + - name: ZBX_HISTORYSTORAGEURL + value: "" + - name: ZBX_HISTORYSTORAGETYPES + value: "" + - name: ZBX_HISTORYSTORAGEDATEINDEX + value: "1" + - name: ZBX_STARTREPORTWRITERS + value: "3" + - name: ZBX_DEBUGLEVEL + value: "3" + - name: ZBX_STARTPOLLERS + value: "" + - name: ZBX_STARTPREPROCESSORS + value: "" + - name: ZBX_STARTPOLLERSUNREACHABLE + value: "" + - name: ZBX_STARTTRAPPERS + value: "" + - name: ZBX_STARTPINGERS + value: "" + - name: ZBX_STARTDISCOVERERS + value: "" + - name: ZBX_STARTHTTPPOLLERS + value: "" + - name: ZBX_IPMIPOLLERS + value: "" + - name: ZBX_STARTTIMERS + value: "" + - name: ZBX_STARTESCALATORS + value: "" + - name: ZBX_STARTALERTERS + value: "" - name: ZBX_JAVAGATEWAY_ENABLE value: "true" + - name: ZBX_JAVAGATEWAY + value: "zabbix-java-gateway" + - name: ZBX_JAVAGATEWAYPORT + value: "10052" - name: ZBX_STARTJAVAPOLLERS value: "5" + - name: ZBX_STARTLLDPROCESSORS + value: "" + - name: ZBX_STATSALLOWEDIP + value: "" + - name: ZBX_STARTVMWARECOLLECTORS + value: "" + - name: ZBX_VMWAREFREQUENCY + value: "" + - name: ZBX_VMWAREPERFFREQUENCY + value: "" + - name: ZBX_VMWARECACHESIZE + value: "" + - name: ZBX_VMWARETIMEOUT + value: "" - name: ZBX_ENABLE_SNMP_TRAPS value: "true" + - name: ZBX_HOUSEKEEPINGFREQUENCY + value: "" + - name: ZBX_MAXHOUSEKEEPERDELETE + value: "" + - name: ZBX_CACHESIZE + value: "" + - name: ZBX_CACHEUPDATEFREQUENCY + value: "" + - name: ZBX_STARTDBSYNCERS + value: "" + - name: ZBX_HISTORYCACHESIZE + value: "" + - name: ZBX_HISTORYINDEXCACHESIZE + value: "" + - name: ZBX_TRENDCACHESIZE + value: "" + - name: ZBX_VALUECACHESIZE + value: "" + - name: ZBX_TIMEOUT + value: "4" + - name: ZBX_TRAPPERIMEOUT + value: "" + - name: ZBX_UNREACHABLEPERIOD + value: "" + - name: ZBX_UNAVAILABLEDELAY + value: "" + - name: ZBX_UNREACHABLEDELAY + value: "" + - name: ZBX_LOGSLOWQUERIES + value: "3000" - name: ZBX_STARTPROXYPOLLERS - value: "5" + value: "" - name: ZBX_PROXYCONFIGFREQUENCY - value: "60" + value: "" + - name: ZBX_PROXYDATAFREQUENCY + value: "" + - name: ZBX_EXPORTFILESIZE + value: "" + - name: ZBX_LOADMODULE + value: "" + - name: ZBX_TLSCAFILE + value: "" + - name: ZBX_TLSCRLFILE + value: "" + - name: ZBX_TLSCERTFILE + value: "" + - name: ZBX_TLSKEYFILE + value: "" + - name: ZBX_TLSCIPHERALL + value: "" + - name: ZBX_TLSCIPHERALL13 + value: "" + - name: ZBX_TLSCIPHERCERT + value: "" + - name: ZBX_TLSCIPHERCERT13 + value: "" + - name: ZBX_TLSCIPHERPSK + value: "" + - name: ZBX_TLSCIPHERPSK13 + value: "" + - name: DEBUG_MODE + value: "false" volumeMounts: - - name: zabbix-db-storage - mountPath: /var/lib/zabbix/snmptraps/ + - name: zabbix-snmptraps + mountPath: "/var/lib/zabbix/snmptraps" readOnly: true + - mountPath: "/tmp/secrets" + name: mysql-tls-certs + readOnly: true + startupProbe: + tcpSocket: + port: 10051 + initialDelaySeconds: 15 + periodSeconds: 5 + timeoutSeconds: 3 + failureThreshold: 40 + livenessProbe: + tcpSocket: + port: 10051 + timeoutSeconds: 3 + failureThreshold: 3 + periodSeconds: 10 + securityContext: + capabilities: {} + privileged: false - name: zabbix-snmptraps image: zabbix/zabbix-snmptraps:alpine-5.0-latest - imagePullPolicy: Always ports: - containerPort: 1162 protocol: UDP name: snmp-trap volumeMounts: - - name: zabbix-db-storage + - name: zabbix-snmptraps mountPath: /var/lib/zabbix/snmptraps/ readOnly: false - volumes: - - hostPath: - path: /zabbix/ - name: zabbix-db-storage + securityContext: + capabilities: {} + privileged: false --- -apiVersion: v1 -kind: ReplicationController +apiVersion: apps/v1 +kind: Deployment metadata: name: zabbix-proxy-sqlite3 labels: @@ -355,13 +618,22 @@ metadata: tier: proxy namespace: zabbix spec: - replicas: 1 + strategy: + type: Recreate + rollingUpdate: null + selector: + matchLabels: + name: zabbix-proxy-sqlite3 + app: zabbix template: metadata: labels: name: zabbix-proxy-sqlite3 app: zabbix spec: + volumes: + - name: proxy-sqlite-data + emptyDir: {} containers: - name: zabbix-proxy-sqlite3 image: zabbix/zabbix-proxy-sqlite3:alpine-5.0-latest @@ -370,16 +642,138 @@ spec: - containerPort: 10051 protocol: TCP name: zabbix-trapper + startupProbe: + tcpSocket: + port: 10051 + initialDelaySeconds: 15 + periodSeconds: 5 + timeoutSeconds: 3 + failureThreshold: 40 + livenessProbe: + tcpSocket: + port: 10051 + timeoutSeconds: 3 + failureThreshold: 3 + periodSeconds: 10 env: - - name: ZBX_HOSTNAME - value: "zabbix-proxy-passive" - - name: ZBX_CONFIGFREQUENCY - value: "60" - name: ZBX_PROXYMODE value: "1" + - name: ZBX_SERVER_HOST + value: "" + - name: ZBX_SERVER_PORT + value: "" + - name: ZBX_HOSTNAME + value: "zabbix-proxy-sqlite" + - name: ZBX_ENABLEREMOTECOMMANDS + value: "0" + - name: ZBX_LOGREMOTECOMMANDS + value: "1" + - name: ZBX_HOSTNAMEITEM + value: "" + - name: ZBX_DEBUGLEVEL + value: "3" + - name: ZBX_PROXYLOCALBUFFER + value: "" + - name: ZBX_PROXYOFFLINEBUFFER + value: "" + - name: ZBX_STARTPOLLERS + value: "" + - name: ZBX_IPMIPOLLERS + value: "" + - name: ZBX_STARTPOLLERSUNREACHABLE + value: "" + - name: ZBX_STARTTRAPPERS + value: "" + - name: ZBX_STARTPINGERS + value: "" + - name: ZBX_STARTDISCOVERERS + value: "" + - name: ZBX_STARTHTTPPOLLERS + value: "" + - name: ZBX_JAVAGATEWAY_ENABLE + value: "true" + - name: ZBX_JAVAGATEWAY + value: "zabbix-java-gateway" + - name: ZBX_JAVAGATEWAYPORT + value: "10052" + - name: ZBX_STARTJAVAPOLLERS + value: "5" + - name: ZBX_STARTVMWARECOLLECTORS + value: "" + - name: ZBX_VMWAREFREQUENCY + value: "" + - name: ZBX_VMWAREPERFFREQUENCY + value: "" + - name: ZBX_VMWARECACHESIZE + value: "" + - name: ZBX_VMWARETIMEOUT + value: "" + - name: ZBX_HOUSEKEEPINGFREQUENCY + value: "" + - name: ZBX_CACHESIZE + value: "" + - name: ZBX_STARTDBSYNCERS + value: "" + - name: ZBX_HISTORYCACHESIZE + value: "" + - name: ZBX_HISTORYINDEXCACHESIZE + value: "" + - name: ZBX_TIMEOUT + value: "4" + - name: ZBX_TRAPPERIMEOUT + value: "" + - name: ZBX_UNREACHABLEPERIOD + value: "" + - name: ZBX_UNAVAILABLEDELAY + value: "" + - name: ZBX_UNREACHABLEDELAY + value: "" + - name: ZBX_LOGSLOWQUERIES + - name: ZBX_LOADMODULE + value: "" + - name: ZBX_TLSCONNECT + value: "" + - name: ZBX_TLSACCEPT + value: "" + - name: ZBX_TLSCAFILE + value: "" + - name: ZBX_TLSCRLFILE + value: "" + - name: ZBX_TLSSERVERCERTISSUER + value: "" + - name: ZBX_TLSSERVERCERTSUBJECT + value: "" + - name: ZBX_TLSCERTFILE + value: "" + - name: ZBX_TLSKEYFILE + value: "" + - name: ZBX_TLSPSKIDENTITY + value: "" + - name: ZBX_TLSPSKFILE + value: "" + - name: ZBX_TLSCIPHERALL + value: "" + - name: ZBX_TLSCIPHERALL13 + value: "" + - name: ZBX_TLSCIPHERCERT + value: "" + - name: ZBX_TLSCIPHERCERT13 + value: "" + - name: ZBX_TLSCIPHERPSK + value: "" + - name: ZBX_TLSCIPHERPSK13 + value: "" + - name: DEBUG_MODE + value: "false" + volumeMounts: + - mountPath: "/var/lib/zabbix/db_data" + name: proxy-sqlite-data + securityContext: + capabilities: {} + privileged: false --- -apiVersion: v1 -kind: ReplicationController +apiVersion: apps/v1 +kind: Deployment metadata: name: zabbix-proxy-mysql labels: @@ -387,13 +781,23 @@ metadata: tier: proxy namespace: zabbix spec: - replicas: 1 + strategy: + type: Recreate + rollingUpdate: null + selector: + matchLabels: + name: zabbix-proxy-mysql + app: zabbix template: metadata: labels: name: zabbix-proxy-mysql app: zabbix spec: + volumes: + - name: mysql-tls-certs + secret: + secretName: zabbix-mysql-client-tls-certs containers: - name: zabbix-proxy-mysql image: zabbix/zabbix-proxy-mysql:alpine-5.0-latest @@ -402,6 +806,16 @@ spec: - containerPort: 10051 protocol: TCP name: zabbix-trapper + readinessProbe: + tcpSocket: + port: zabbix-trapper + initialDelaySeconds: 5 + periodSeconds: 10 + livenessProbe: + tcpSocket: + port: zabbix-trapper + initialDelaySeconds: 15 + periodSeconds: 20 env: - name: MYSQL_USER valueFrom: @@ -420,9 +834,144 @@ spec: key: db-root-pass - name: MYSQL_DATABASE value: "zabbix_proxy" + - name: ZBX_DBTLSCONNECT + value: "required" + - name: ZBX_DBTLSCAFILE + value: "/tmp/secrets/root-ca.pem" + - name: ZBX_DBTLSCERTFILE + value: "/tmp/secrets/client-cert.pem" + - name: ZBX_DBTLSKEYFILE + value: "/tmp/secrets/client-key.pem" + - name: ZBX_DBTLSCIPHER + value: "" + - name: ZBX_DBTLSCIPHER13 + value: "" + - name: ZBX_PROXYMODE + value: "0" + - name: ZBX_SERVER_HOST + value: "zabbix-server" + - name: ZBX_SERVER_PORT + value: "10051" + - name: ZBX_HOSTNAME + value: "zabbix-proxy-mysql" + - name: ZBX_ENABLEREMOTECOMMANDS + value: "0" + - name: ZBX_LOGREMOTECOMMANDS + value: "1" + - name: ZBX_HOSTNAMEITEM + value: "" + - name: ZBX_DEBUGLEVEL + value: "3" + - name: ZBX_PROXYLOCALBUFFER + value: "" + - name: ZBX_PROXYOFFLINEBUFFER + value: "" + - name: ZBX_PROXYHEARTBEATFREQUENCY + value: "" + - name: ZBX_CONFIGFREQUENCY + value: "" + - name: ZBX_DATASENDERFREQUENCY + value: "" + - name: ZBX_STARTPOLLERS + value: "" + - name: ZBX_IPMIPOLLERS + value: "" + - name: ZBX_STARTPOLLERSUNREACHABLE + value: "" + - name: ZBX_STARTTRAPPERS + value: "" + - name: ZBX_STARTPINGERS + value: "" + - name: ZBX_STARTDISCOVERERS + value: "" + - name: ZBX_STARTHTTPPOLLERS + value: "" + - name: ZBX_JAVAGATEWAY_ENABLE + value: "true" + - name: ZBX_JAVAGATEWAY + value: "zabbix-java-gateway" + - name: ZBX_JAVAGATEWAYPORT + value: "10052" + - name: ZBX_STARTJAVAPOLLERS + value: "5" + - name: ZBX_STARTVMWARECOLLECTORS + value: "" + - name: ZBX_VMWAREFREQUENCY + value: "" + - name: ZBX_VMWAREPERFFREQUENCY + value: "" + - name: ZBX_VMWARECACHESIZE + value: "" + - name: ZBX_VMWARETIMEOUT + value: "" + - name: ZBX_HOUSEKEEPINGFREQUENCY + value: "" + - name: ZBX_CACHESIZE + value: "" + - name: ZBX_STARTDBSYNCERS + value: "" + - name: ZBX_HISTORYCACHESIZE + value: "" + - name: ZBX_HISTORYINDEXCACHESIZE + value: "" + - name: ZBX_TIMEOUT + value: "4" + - name: ZBX_TRAPPERIMEOUT + value: "" + - name: ZBX_UNREACHABLEPERIOD + value: "" + - name: ZBX_UNAVAILABLEDELAY + value: "" + - name: ZBX_UNREACHABLEDELAY + value: "" + - name: ZBX_LOGSLOWQUERIES + value: "" + - name: ZBX_LOADMODULE + value: "" + - name: ZBX_TLSCONNECT + value: "" + - name: ZBX_TLSACCEPT + value: "" + - name: ZBX_TLSCAFILE + value: "" + - name: ZBX_TLSCRLFILE + value: "" + - name: ZBX_TLSSERVERCERTISSUER + value: "" + - name: ZBX_TLSSERVERCERTSUBJECT + value: "" + - name: ZBX_TLSCERTFILE + value: "" + - name: ZBX_TLSKEYFILE + value: "" + - name: ZBX_TLSPSKIDENTITY + value: "" + - name: ZBX_TLSPSKFILE + value: "" + - name: ZBX_TLSCIPHERALL + value: "" + - name: ZBX_TLSCIPHERALL13 + value: "" + - name: ZBX_TLSCIPHERCERT + value: "" + - name: ZBX_TLSCIPHERCERT13 + value: "" + - name: ZBX_TLSCIPHERPSK + value: "" + - name: ZBX_TLSCIPHERPSK13 + value: "" + - name: DEBUG_MODE + value: "false" + volumeMounts: + - mountPath: "/tmp/secrets" + name: mysql-tls-certs + readOnly: true + securityContext: + capabilities: {} + privileged: false --- -apiVersion: v1 -kind: ReplicationController +apiVersion: apps/v1 +kind: Deployment metadata: name: zabbix-java-gateway labels: @@ -430,7 +979,10 @@ metadata: tier: java namespace: zabbix spec: - replicas: 1 + selector: + matchLabels: + name: zabbix-java-gateway + app: zabbix template: metadata: labels: @@ -444,10 +996,27 @@ spec: ports: - containerPort: 10052 protocol: TCP - name: zabbix-jmx + name: zabbix-java + livenessProbe: + tcpSocket: + port: 10052 + initialDelaySeconds: 5 + failureThreshold: 3 + periodSeconds: 2 env: - - name: ZBX_TIMEOUT + - name: ZBX_START_POLLERS value: "5" + - name: ZBX_TIMEOUT + value: "3" + - name: ZBX_DEBUGLEVEL + value: "info" + - name: JAVA_OPTIONS + value: "" + - name: DEBUG_MODE + value: "false" + securityContext: + capabilities: {} + privileged: false --- apiVersion: apps/v1 kind: DaemonSet @@ -471,6 +1040,13 @@ spec: name: zabbix-agent app: zabbix spec: + hostNetwork: true + hostIPC: true + hostPID: true + automountServiceAccountToken: true + serviceAccountName: zabbix-agent + nodeSelector: + beta.kubernetes.io/os: linux containers: - name: zabbix-agent image: zabbix/zabbix-agent:alpine-5.0-latest @@ -485,17 +1061,134 @@ spec: ports: - containerPort: 10050 name: zabbix-agent + livenessProbe: + tcpSocket: + port: 10050 + initialDelaySeconds: 5 + failureThreshold: 3 + periodSeconds: 2 env: - - name: ZBX_SERVER_HOST - value: "zabbix-server" - - name: ZBX_PASSIVE_ALLOW - value: "true" - - name: ZBX_STARTAGENTS - value: "3" - - name: ZBX_TIMEOUT - value: "10" + - name: ZBX_DEBUGLEVEL + value: "3" + - name: ZBX_DENYKEY + value: "system.run[*]" + - name: ZBX_ALLOWKEY + value: "" + - name: ZBX_LOGREMOTECOMMANDS + value: "1" + - name: ZBX_SERVER_HOST + value: "zabbix-server" + - name: ZBX_PASSIVE_ALLOW + value: "true" + - name: ZBX_PASSIVESERVERS + value: "" + - name: ZBX_ACTIVE_ALLOW + value: "true" + - name: ZBX_ACTIVESERVERS + value: "" + - name: ZBX_STARTAGENTS + value: "" + - name: ZBX_HOSTNAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: ZBX_HOSTNAMEITEM + value: "" + - name: ZBX_METADATA + value: "" + - name: ZBX_METADATAITEM + value: "" + - name: ZBX_TIMEOUT + value: "" + - name: ZBX_BUFFERSEND + value: "" + - name: ZBX_BUFFERSIZE + value: "" + - name: ZBX_MAXLINESPERSECOND + value: "" + - name: ZBX_UNSAFEUSERPARAMETERS + value: "0" + - name: ZBX_LOADMODULE + value: "" + - name: ZBX_HOSTINTERFACE + value: "" + - name: ZBX_HOSTINTERFACEITEM + value: "" + - name: ZBX_REFRESHACTIVECHECKS + value: "" + - name: DEBUG_MODE + value: "3" + - name: ZBX_TLSCONNECT + value: "" + - name: ZBX_TLSACCEPT + value: "" + - name: ZBX_TLSCAFILE + value: "" + - name: ZBX_TLSCRLFILE + value: "" + - name: ZBX_TLSSERVERCERTISSUER + value: "" + - name: ZBX_TLSSERVERCERTSUBJECT + value: "" + - name: ZBX_TLSCERTFILE + value: "" + - name: ZBX_TLSKEYFILE + value: "" + - name: ZBX_TLSPSKIDENTITY + value: "" + - name: ZBX_TLSPSKFILE + value: "" + - name: ZBX_TLSCIPHERALL + value: "" + - name: ZBX_TLSCIPHERALL13 + value: "" + - name: ZBX_TLSCIPHERCERT + value: "" + - name: ZBX_TLSCIPHERCERT13 + value: "" + - name: ZBX_TLSCIPHERPSK + value: "" + - name: ZBX_TLSCIPHERPSK13 + value: "" securityContext: + capabilities: {} privileged: true + readOnlyRootFilesystem: false + runAsNonRoot: true + volumeMounts: + - name: dev-volume + mountPath: /node/dev + - name: procfs-volume + readOnly: true + mountPath: /node/proc + - name: boot-volume + readOnly: true + mountPath: /node/boot + - name: run-volume + mountPath: /node/run + - name: var-run-volume + mountPath: /node/var/run + volumes: + - name: dev-volume + hostPath: + path: /dev + type: '' + - name: procfs-volume + hostPath: + path: /proc + type: '' + - name: boot-volume + hostPath: + path: /boot + type: '' + - name: run-volume + hostPath: + path: /run + type: '' + - name: var-run-volume + hostPath: + path: /var/run + type: '' --- apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler @@ -515,23 +1208,8 @@ spec: name: cpu targetAverageUtilization: 70 --- -kind: PersistentVolume apiVersion: v1 -metadata: - name: zabbix-mysql-data - labels: - type: local - namespace: zabbix -spec: - capacity: - storage: 1Gi - accessModes: - - ReadWriteOnce - hostPath: - path: "/data" ---- kind: PersistentVolumeClaim -apiVersion: v1 metadata: name: zabbix-mysql-data-claim namespace: zabbix @@ -540,8 +1218,7 @@ spec: - ReadWriteOnce resources: requests: - storage: 1Gi - volumeName: zabbix-mysql-data + storage: 20Gi --- apiVersion: v1 kind: List @@ -558,3 +1235,25 @@ items: db-root-pass: "c29tZV90ZXN0X3Bhc3M=" db-zbx-user: "emFiYml4" db-zbx-pass: "emJ4X3Bhc3N3b3Jk" +--- +apiVersion: v1 +data: + root-ca.pem: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURVekNDQWp1Z0F3SUJBZ0lKQUxNWTFSWlB5VVZsTUEwR0NTcUdTSWIzRFFFQkN3VUFNRUF4RXpBUkJnb0oKa2lhSmsvSXNaQUVaRmdOamIyMHhGekFWQmdvSmtpYUprL0lzWkFFWkZnZGxlR0Z0Y0d4bE1SQXdEZ1lEVlFRRApEQWRHWVd0bExVTkJNQjRYRFRJeE1Ea3lNakV4TlRJMU1Gb1hEVE14TURnd01URXhOVEkxTUZvd1FERVRNQkVHCkNnbVNKb21UOGl4a0FSa1dBMk52YlRFWE1CVUdDZ21TSm9tVDhpeGtBUmtXQjJWNFlXMXdiR1V4RURBT0JnTlYKQkFNTUIwWmhhMlV0UTBFd2dnRWlNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUJEd0F3Z2dFS0FvSUJBUURqRjQ1NApXTVVKc1NqZ3ZzSk4rNE5na3dET2thUWdOMjdXVnJyVWRIVjhoVW9sYU4vMWdSeE80cTNES2lPRnhIZlBITzVXCmg0am1YQ3VVSTA0NXRwaEVaZDlCZDd4eUU2dUF3VGtya2pVWTczMExQRmZsYzJYQXE3TkYvMElidHB1aXQ3cFIKdUV2dTc0aVNMampLWVFaWHlxUGJLazlIaitWa2xCcTV2MjJUNTlxUmwzeFV5QUNRZGVEWVdPbTg2ZFgrY2FUVAorWWt6VXhDOHFRVVdBT2JUVThBWWZXbHA3NjRpY0NuMEdab3BCalN2dXQrZWxoTnl2eHk2alhRdU0xemZYMXUrCm56bVdiQzdOMTFqK2JDZWxVd2kwQUhIZUZrRFFrcHdPaGdycW9hbG5XUHk4VVNjMDFJRTIwZnlmTEptc3ZaVU4KZ3pnK0EwOGNqOThwemF2REFnTUJBQUdqVURCT01CMEdBMVVkRGdRV0JCVGtEenFQVEV0UGFHWWhBSzkrNjB6dgpBdklmS1RBZkJnTlZIU01FR0RBV2dCVGtEenFQVEV0UGFHWWhBSzkrNjB6dkF2SWZLVEFNQmdOVkhSTUVCVEFECkFRSC9NQTBHQ1NxR1NJYjNEUUVCQ3dVQUE0SUJBUURaY1A2cmJPWFMvSFcray8yczU1Nk14VU9vTkRNenRhdlIKQXJCa01HUGk5N2FGSW1MV2h6MVJqWGw3UjZKUmE0a3VVSGdiRXBuL3F1OUFISk1LejZ6UnVSRW9EM2UzTlIwVApJL3hkbHFJOVBzTmdIaDVwSzcvb281TzUrR21vTURoK3pRTHlnbXVYcWlSenpXV3NBOVcwaXpoMFJiZHRwQzR5CmdSYmxLMVBsTVhNeWs0eFArcHljV0treExMbWhqOWhuTDdkQlR3KzQzOW13eW5MZjlhSkdHajZaNmI2ZjJTS1EKWGlPZUNFOTVQRlR4S1BCbzRvQmdjOHI2NGFxc0FNelVCa0lQZWtnQ2xQWkJJSnJtKzZZdU9HbUROVUFtUCs3RApKdmRIbGVucGJ3RXJBZ3FKYWx4NjdxVGM2eVUzWUY5bTZMTkprRHlCYXJ6VU01MVdQc1JUCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K + server-cert.pem: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMrVENDQWVFQ0FRRXdEUVlKS29aSWh2Y05BUUVMQlFBd1FERVRNQkVHQ2dtU0pvbVQ4aXhrQVJrV0EyTnYKYlRFWE1CVUdDZ21TSm9tVDhpeGtBUmtXQjJWNFlXMXdiR1V4RURBT0JnTlZCQU1NQjBaaGEyVXRRMEV3SGhjTgpNakV3T1RJeU1URTFNalV4V2hjTk16RXdPREF4TVRFMU1qVXhXakJGTVJNd0VRWUtDWkltaVpQeUxHUUJHUllEClkyOXRNUmN3RlFZS0NaSW1pWlB5TEdRQkdSWUhaWGhoYlhCc1pURVZNQk1HQTFVRUF3d01iWGx6Y1d3dGMyVnkKZG1WeU1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBb0U2OVRZcFNqMDhTMmZoNQorYUtIQVlwT2JmbkR1Z01XNTlsOXljUFdoYUVqVzNaaXp1UkNoMWV1eUR0YnFlUzRubnpIY3RlKzF2TE9xcHA2CnQ2RmM5azROcDFqYkMyRUoxUWUyRDNvVTdpdEVTMnBXV2g1Rm4xR1dwek5FOXhxM2c2MFdBd1BZTG1MMUdDTloKNUdpU0ZENjBSei85WTdUYjFrVDl1RzVPUUVLeUg2dk42QjZ0N2ZTRk9TRmhVaVc4QVc1bTBZNngxdHhNSkcvRgpqamJGTGdHTTV2SXhuTHlwRW5uNm01UXV5enlSbm9rQVNESCtieVVtV1hhWUcvODUwODNEN0FBblN2UmZzb2pyCjhaQkVPd0QwVUtmNFZDaVl0b0hPanFhWmdUMElSWmhabGozR3U1TG9uZkx1S3lMN0ZtZmhLRmwrZnNOVGx3OGEKMVlqSkN3SURBUUFCTUEwR0NTcUdTSWIzRFFFQkN3VUFBNElCQVFCaUMxWjNLcUV2clRZU0V6eDJPcExnNFpKMwo1OTFjUFI2UEs2OXBESmQ0MWFCdnY5Mko3TmdxVUpqZ0VvZ0FsUWpZZmFJNDQ4MUZTUngvbDBKeDdwaXNPSTY0Cm1BSy96bXh6bXEzKzJCY016aXc1a09ZUFpHVGh3a0NUYnRjaWNYSTBveVNNUC8yN3hjTmFyZEdyaVdRMGJBZFcKOEIyNTY5TFQwWDA2ZWtHdktOS0xucnBBQk5FanBJelJyZXgyaSsrQnEybUVhTHRYQWVMVmtvbmUxNzFjUDFBWgpuVktmekNqQ3U1T0ZsNm1ST2dCRnMyMUtiU2RnQzl2K0JITFhmK3pXeTB1NDZjUmg1U09vb0VDSkJPNVlEVERrCm5ldDB2dUZtdUFZS3NINjRLMm9jU3IwYjBBZVlmbFRnalBKZktTS2ZXbnhKQnFnMnJ5azBlT3lUQnRVTgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg== + server-key.pem: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFb2dJQkFBS0NBUUVBb0U2OVRZcFNqMDhTMmZoNSthS0hBWXBPYmZuRHVnTVc1OWw5eWNQV2hhRWpXM1ppCnp1UkNoMWV1eUR0YnFlUzRubnpIY3RlKzF2TE9xcHA2dDZGYzlrNE5wMWpiQzJFSjFRZTJEM29VN2l0RVMycFcKV2g1Rm4xR1dwek5FOXhxM2c2MFdBd1BZTG1MMUdDTlo1R2lTRkQ2MFJ6LzlZN1RiMWtUOXVHNU9RRUt5SDZ2Tgo2QjZ0N2ZTRk9TRmhVaVc4QVc1bTBZNngxdHhNSkcvRmpqYkZMZ0dNNXZJeG5MeXBFbm42bTVRdXl6eVJub2tBClNESCtieVVtV1hhWUcvODUwODNEN0FBblN2UmZzb2pyOFpCRU93RDBVS2Y0VkNpWXRvSE9qcWFaZ1QwSVJaaFoKbGozR3U1TG9uZkx1S3lMN0ZtZmhLRmwrZnNOVGx3OGExWWpKQ3dJREFRQUJBb0lCQUh0NWlxZmlCZ3RxSFp3VQpubWJnZjlwNDNFWXJIazMxT1R4bHNsU3BhbC9OS1AyMjV3NXlsS2ZJcXRDQm4rM3hSUjZWLzgzK1RYa2sxbmhqCnVtZ2NldzBnTzdZTlk5S1U4TXpNUHJnWEVXNE5sM0g3T3YzNDJTbUkzMkJ6eGdnSzVSVWdTWmNTNi8xMnJVL2wKVXNUeW9xbkRUbnFlMkI1blhQamlkUWNNdDJzWWUralpUcGRWVHhVUUxlUWZsVC9ZcWVsM2pxZTJwZXVzK25USAp6dHRGRkFvb05IN0xtVHpJSFJtNnhuSDVoMmptcFZOZVRudkczb09sRk9mNmlObWp5blE3d3p6U1BWRHNQa3lJCmdpMGwrT0VGZFY5bUwyS2xEbnlpL25xM1d1d3E5L1NpVStXbFNmUjhMd21JaXYrY0ZOSVl6SnYyUTAvSkRmRGwKN2g5Y3FkRUNnWUVBMHFMazZzZ3d2ckZqam5weHhKMmRsMi9IWGZoaUxRWC9FcXVQVUJUYllCM0EwMUR1dDlHQQp0T3V2VlVEQWREV2lpMkZMQ1pwdFh0OUZ5c1A1UW1USkxaY2JsNG14L2ptdmxvb2ZPQzNDY0JBaEZLOGdoU2FTCjNFMGZmWVJmalE2U2F4WkF3WEJwR3lUSHpYY2c5dzViNCtJWUx2TWg5aGZha0JpVFpwY09HVU1DZ1lFQXd0VU0KZ3F4Y3piK0dMQThpOHc4Z3hmM1FNWXpXWUtwSlVqRUV3SFJjcTlRdVFHVDFFVlMzNzJwbU5mRXZQWmVTKyszUQp2Y01KS1hpeXUwZ0FUaFVSMDhndkpxVXdscHFwSUsvQ2c2b0tYRzV2SjM1Z1ZJSExKSFFMK3UzUlRXVVhRTlRXCkUrdS9NeTMzYlhaUHlodWUrb2VYU1NVQ1kxaEw3OE5BbE5jaWtKa0NnWUFKMDBGY1ZrUTMwT3gwNis4OG5hR0oKTzlTUDVKTW55SHpTY1NBNU93L1VsdTYwckxURjdFYlZxWnkvSEVzZDRKYVphOHRsUWtmUndoWnVVOS9mb2ZYawpZNFVNOTRaTzluL2pSTVFhQ2NCbEc4dC9QSUFHMWZySnZlczNIcUthWU5DaG9DTWJJdFEwU08zcy9wNlNCNkJ2CnE4ODIrVzVmSFZPN252blpNamlkSXdLQmdFend4OHorOW5OR05GMUg2UHhsdUFLWWRsUnJFdW4vdFk3Z3pzaVYKNjFic0p3dkZFc2F5VnlVVU5xTU15U1FncktvU3c0RjgrU3hJZndUWXJVNG9vZTZwdW4wZmRTMjBqQi9kYVFxSAo1eW1UYnhBQXAxZ1lIYm9hbmZTTllEK1pNWEtuMnBicFhZdC9scHZDd2tYRlhLWUJUK3hSMGp5YlRQbTFlTmFPCmt4YlpBb0dBWjNiZk5EUGpBRlYwWjhYTktGZjcrTStHaHNaLzZRdFpGSFRBRnZEZk1KU1pBQmozZmJOQkRJSmoKemJTenlGT2xPSklaN21rWWNxNE50MGNseldUQ0FoRHlBbDdkbTZ2dkdQZ2xhOUZ2OHpKN0JhVEtRaVFGL1pPWQpOZGRpT3ZiMXBTUTFwL2ZOUkN2SUU2Z1hZeXdnUXN2VU80czV4OTg5OEZuMGtTMWRXK0E9Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg== +kind: Secret +metadata: + name: zabbix-mysql-server-tls-certs + namespace: zabbix +type: Opaque +--- +apiVersion: v1 +data: + client-cert.pem: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4ekNDQWRzQ0FRRXdEUVlKS29aSWh2Y05BUUVMQlFBd1FERVRNQkVHQ2dtU0pvbVQ4aXhrQVJrV0EyTnYKYlRFWE1CVUdDZ21TSm9tVDhpeGtBUmtXQjJWNFlXMXdiR1V4RURBT0JnTlZCQU1NQjBaaGEyVXRRMEV3SGhjTgpNakV3T1RJeU1URTFNalV4V2hjTk16RXdPREF4TVRFMU1qVXhXakEvTVJNd0VRWUtDWkltaVpQeUxHUUJHUllEClkyOXRNUmN3RlFZS0NaSW1pWlB5TEdRQkdSWUhaWGhoYlhCc1pURVBNQTBHQTFVRUF3d0dZMnhwWlc1ME1JSUIKSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXVZTllXVUp3Y2Nsd0oxbnYwS1YyNGVncQpUQW1vM1N5cTFwMS9OTGZIdGd1UVcyZllSUXJkVFZ5OU80R0VyWmUwVCtmMnFwRUtPN2JoSExvVElnMFZXQmNoClU4K2g1dVhSZlVhZC90eHVKNWh0QnBIL1hpR0NEbVFpSFVtd0hxbHJwK0pDL3lmTzJwb3pDalpaOVF4RVBlYjgKQmEwaHgycUZXUEtKc1ZSY0JTejMzMm1tY1ZjeGE5YmtsWVVQZHgwUTVGSHFWZ1pXOTI0QXdHOC95QThxcUFiNApPcVkxbUZkUW9VaW9kTjRGUDQzSkVGSWxrMnExWUVjenlSMHlidVJIelBIQjhJUG1Fa2lNaHlpSitsdnJaSzZLCjR5NWZVSzQ0SXkxanYveEJDSnJ3TmNnVVZBdGFYTStiV2RXS3U4dDNudGV6ME02ZWU2Ym5WSHhTeDh0NWF3SUQKQVFBQk1BMEdDU3FHU0liM0RRRUJDd1VBQTRJQkFRQW9SOE5SZEo4YUJsWnZBOWFCVzQ1SFdnWGF0Z1ExcGRpNwo3R1BpL3Qzem5MWTNNamMrUVZSdmZLUlFvU2wwc095NUZ5NFlZWHdwZDlQRUsxVXBReFRaK201SGtVWm9LR095CnlISzZ1aGZ6NFY5NXNRdkcvdGcvaS9ESHQvVlJYMEpsc2lpTW1zalFYRFpPcUpaOUNPTnhOYUlObkdSZGZEUVoKNVRneUEraXVyTU5mcThpUU9HcDhYRGkzNStvMlp4enpDWHl3SGRRVDExcTdSbThBZDNGaG5xKzJQVGR0UDduYwpZWFB4Ym1ibkxMeTBReFl3Y1BYQlkrWjNrTFlxbk1wK2ozajIwcE0rTE1sMkNBbTNDblJsdU9yKytrTTV1T29hCnkxOHN6QWJRSjF4L0RoMEFmQUZKOG90THMrUU9IU2prdUoveEJCelkxelNETnRNdmxUMDEKLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo= + client-key.pem: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFb2dJQkFBS0NBUUVBdVlOWVdVSndjY2x3SjFudjBLVjI0ZWdxVEFtbzNTeXExcDEvTkxmSHRndVFXMmZZClJRcmRUVnk5TzRHRXJaZTBUK2YycXBFS083YmhITG9USWcwVldCY2hVOCtoNXVYUmZVYWQvdHh1SjVodEJwSC8KWGlHQ0RtUWlIVW13SHFscnArSkMveWZPMnBvekNqWlo5UXhFUGViOEJhMGh4MnFGV1BLSnNWUmNCU3ozMzJtbQpjVmN4YTlia2xZVVBkeDBRNUZIcVZnWlc5MjRBd0c4L3lBOHFxQWI0T3FZMW1GZFFvVWlvZE40RlA0M0pFRklsCmsycTFZRWN6eVIweWJ1Ukh6UEhCOElQbUVraU1oeWlKK2x2clpLNks0eTVmVUs0NEl5MWp2L3hCQ0pyd05jZ1UKVkF0YVhNK2JXZFdLdTh0M250ZXowTTZlZTZiblZIeFN4OHQ1YXdJREFRQUJBb0lCQUdYaVRlNVB2K091Und0RgpxS0RGanlJSTJOb0Q0QnNBZ2g3MlJydVVSM21pcGppZE1yalFlN1FXUDlOamtaT3BJcDFUL3pPMERwTzNIN0VnClBJdlI5YXY0b0JRZ2o0RjVMSEdLREJIQnpEbXd6QWYwdlBSY29NbjRrb2ZWUllYQmRGK3lzeXJoR1FrVDhQNGwKMVlmd29iWUJtdDRmTk5NSm5JeTZQNGNGbHJnOEJlcmVnRFp2Z3FqWlN3Q3RoUDV4QzMzeEFEaGtJazVuVk80QQpTNEpEUGNSTDNkaU5IK3YxRkVhY2EraGc3dzNpY09XZWQ4Y0xMQnJqZmpkaXJkTUpXRW52NnYrSlgzZ2N4bjg2CkxpeXZkSk9ZNTdqSFZpTndLQ0NwQlJOVUJmbWFhK2lXNEs5QTE3K0h5VmdUTFZnLzhoeGZwV292Nkc3UEh2NTcKaXlJelBya0NnWUVBOXpjV042bW95Q0VCc0ZYRzBDTk5DdE54RHVjU290ZVoxK0JqZENBbnZycnRiQVNubUZUOAppdG5LaFR3Nkl4K3lkNzJaeXNHWkI2MGloTXZsRlhMUnRtQ0pUVGpWY0xDOXVhM2t1OHZYUzdBdmQ4YWZUcmJoCmlLeVRLMmg5NklxYUpxQzR6R0tkNStLejhKZFM0RGpjdmRUTlhSOHp6MGQxLzg1c0hXZDhsNDhDZ1lFQXdCcjAKZXZpbFN0cjdhZGxWY0tONnQ0ZWxlVXJjVTdYdElSZDhncjNpSk5jUGo0MENVUW0xTXZ5WXhTckR5MEpTQVdLbwpHWkswQVE3S1oyY2FoK2JWV3dvUnVES1hBR0NHQVE3ODRrU3lqQisrQkpqaWhDNHZkNERrcGFpSVYvdVY1NEwxCnZQVDNQcC9PdncyQU4yU0lHcWJwMjM0SmJzWlNCWVVYbWVKNmNtVUNnWUFhN1BNTWlQd0xJQjB3K1lhMzhNQloKWjRJdTMxZ1dTR2xISy9kcEZIOS90SmhiWlg1amh3NGlpV29YYk9IZ0pYbW90UXZsRzRUeFl4Z1pZcVBHM0VTZgpHcENaeXBEa3Z6dEsxL2ZMeEgza2pvSDlCN01lUGFqKzI5MERvMVBqV2dWRUk4azg2WmpOUXRIYWFJRHNUd1VyCjM5dW1RdG0vdjhiSVg5RkN1cHpGWFFLQmdBbDhTejRYTVBJMVJkekFJbnZoVnBuaFZNWmNiK3lpT3djN1JhYWYKQVorWUR1aWpxYzJla1JmbmFST3pQTis0Y3B3bTV1MzhWRzhJNysyVEpiZzRLYWpKSW43WjRLTGdJVDNFSTdCNAplK2gzV01hWlZmWDQ0ZGNnd2lsNzNOK2JTSmVaMjlCc3VCaWJnM1hqa01VcmJaMERTT0RScEYyWDVVem9lWFhiCnZQZ1JBb0dBSjVvLzNIOWJCbEp3b3Z0WjF5VUY2KzRjaFpodGhiU1VJOS9zSXFueHllNEtZMGtMaEpxU013ZkEKZ1hPSW10cmxzNllxU3VkVGovaGNwbi85VDIzbnFOSEpyd3RKWXJVMk9zdUYrdnNHUE5DeFQwZTUrSXZlQ015QQplZFhuSU9BaTBjSXhxUjluWVNXNDR0cjFEcG8rN1c5SEZ5aXZ5eVZ4M09uMzlMUi9EUHM9Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg== + root-ca.pem: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURVekNDQWp1Z0F3SUJBZ0lKQUxNWTFSWlB5VVZsTUEwR0NTcUdTSWIzRFFFQkN3VUFNRUF4RXpBUkJnb0oKa2lhSmsvSXNaQUVaRmdOamIyMHhGekFWQmdvSmtpYUprL0lzWkFFWkZnZGxlR0Z0Y0d4bE1SQXdEZ1lEVlFRRApEQWRHWVd0bExVTkJNQjRYRFRJeE1Ea3lNakV4TlRJMU1Gb1hEVE14TURnd01URXhOVEkxTUZvd1FERVRNQkVHCkNnbVNKb21UOGl4a0FSa1dBMk52YlRFWE1CVUdDZ21TSm9tVDhpeGtBUmtXQjJWNFlXMXdiR1V4RURBT0JnTlYKQkFNTUIwWmhhMlV0UTBFd2dnRWlNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUJEd0F3Z2dFS0FvSUJBUURqRjQ1NApXTVVKc1NqZ3ZzSk4rNE5na3dET2thUWdOMjdXVnJyVWRIVjhoVW9sYU4vMWdSeE80cTNES2lPRnhIZlBITzVXCmg0am1YQ3VVSTA0NXRwaEVaZDlCZDd4eUU2dUF3VGtya2pVWTczMExQRmZsYzJYQXE3TkYvMElidHB1aXQ3cFIKdUV2dTc0aVNMampLWVFaWHlxUGJLazlIaitWa2xCcTV2MjJUNTlxUmwzeFV5QUNRZGVEWVdPbTg2ZFgrY2FUVAorWWt6VXhDOHFRVVdBT2JUVThBWWZXbHA3NjRpY0NuMEdab3BCalN2dXQrZWxoTnl2eHk2alhRdU0xemZYMXUrCm56bVdiQzdOMTFqK2JDZWxVd2kwQUhIZUZrRFFrcHdPaGdycW9hbG5XUHk4VVNjMDFJRTIwZnlmTEptc3ZaVU4KZ3pnK0EwOGNqOThwemF2REFnTUJBQUdqVURCT01CMEdBMVVkRGdRV0JCVGtEenFQVEV0UGFHWWhBSzkrNjB6dgpBdklmS1RBZkJnTlZIU01FR0RBV2dCVGtEenFQVEV0UGFHWWhBSzkrNjB6dkF2SWZLVEFNQmdOVkhSTUVCVEFECkFRSC9NQTBHQ1NxR1NJYjNEUUVCQ3dVQUE0SUJBUURaY1A2cmJPWFMvSFcray8yczU1Nk14VU9vTkRNenRhdlIKQXJCa01HUGk5N2FGSW1MV2h6MVJqWGw3UjZKUmE0a3VVSGdiRXBuL3F1OUFISk1LejZ6UnVSRW9EM2UzTlIwVApJL3hkbHFJOVBzTmdIaDVwSzcvb281TzUrR21vTURoK3pRTHlnbXVYcWlSenpXV3NBOVcwaXpoMFJiZHRwQzR5CmdSYmxLMVBsTVhNeWs0eFArcHljV0treExMbWhqOWhuTDdkQlR3KzQzOW13eW5MZjlhSkdHajZaNmI2ZjJTS1EKWGlPZUNFOTVQRlR4S1BCbzRvQmdjOHI2NGFxc0FNelVCa0lQZWtnQ2xQWkJJSnJtKzZZdU9HbUROVUFtUCs3RApKdmRIbGVucGJ3RXJBZ3FKYWx4NjdxVGM2eVUzWUY5bTZMTkprRHlCYXJ6VU01MVdQc1JUCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K +kind: Secret +metadata: + name: zabbix-mysql-client-tls-certs + namespace: zabbix +type: Opaque