Updated build script

This commit is contained in:
Alexey Pustovalov 2021-10-12 01:41:42 +02:00
commit 83446caadf
147 changed files with 6625 additions and 2999 deletions

View File

@ -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 }}

View File

@ -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"}

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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/ && \

View File

@ -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 <alexey.pustovalov@zabbix.com>" `
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

View File

@ -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"
}

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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-<version>`
## `zabbix-agent2:ubuntu-<version>`
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-<version>`
## `zabbix-agent2:ol-<version>`
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.

View File

@ -0,0 +1 @@
build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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"]

View File

@ -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-<version>`
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-<version>`
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-<version>`
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.

View File

@ -0,0 +1 @@
../../../build.sh

View File

@ -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 "$@"
#################################################

View File

@ -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 .

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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-<version>`
## `zabbix-agent2:ubuntu-<version>`
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-<version>`
## `zabbix-agent2:ol-<version>`
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.

View File

@ -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/ && \

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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/ && \

View File

@ -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-<version>`
## `zabbix-agent2:ubuntu-<version>`
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-<version>`
## `zabbix-agent2:ol-<version>`
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.

View File

@ -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 <alexey.pustovalov@zabbix.com>" `
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

View File

@ -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"
}

View File

@ -0,0 +1 @@
build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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/*

View File

@ -0,0 +1 @@
../../../build.sh

View File

@ -0,0 +1 @@
build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -0,0 +1 @@
../../../build.sh

View File

@ -0,0 +1 @@
build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -0,0 +1 @@
../../../build.sh

View File

@ -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

View File

@ -0,0 +1 @@
build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -0,0 +1 @@
../../../build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" `
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...';

View File

@ -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 <alexey.pustovalov@zabbix.com>" `
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;

View File

@ -0,0 +1 @@
build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -0,0 +1 @@
../../../build.sh

View File

@ -0,0 +1 @@
build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -0,0 +1 @@
../../../build.sh

View File

@ -0,0 +1 @@
build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -0,0 +1 @@
../../../build.sh

View File

@ -0,0 +1 @@
build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -0,0 +1 @@
../../../build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" `
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...';

View File

@ -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 <alexey.pustovalov@zabbix.com>" `
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...';

View File

@ -0,0 +1 @@
build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -0,0 +1 @@
../../../build.sh

View File

@ -0,0 +1 @@
build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -0,0 +1 @@
../../../build.sh

View File

@ -0,0 +1 @@
build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -0,0 +1 @@
../../../build.sh

View File

@ -0,0 +1 @@
build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -0,0 +1 @@
../../../build.sh

View File

@ -0,0 +1 @@
build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -0,0 +1 @@
../../../build.sh

View File

@ -0,0 +1 @@
build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -0,0 +1 @@
../../../build.sh

View File

@ -0,0 +1 @@
build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -0,0 +1 @@
../../../build.sh

View File

@ -0,0 +1 @@
build.sh

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -0,0 +1 @@
../../../build.sh

View File

@ -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 "$@"
#################################################

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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-<version>`
## `zabbix-java-gateway:ol-<version>`
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

View File

@ -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 "/^.*<root level=/s/=.*/=\"${ZBX_DEBUGLEVEL}\">/" "$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 "/^.*<root level=/s/=.*/=\"${ZBX_DEBUGLEVEL}\">/" "$ZBX_GATEWAY_CONFIG"
}
prepare_java_gateway() {

View File

@ -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 \

View File

@ -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 "/^.*<root level=/s/=.*/=\"${ZBX_DEBUGLEVEL}\">/" "$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 "/^.*<root level=/s/=.*/=\"${ZBX_DEBUGLEVEL}\">/" "$ZBX_GATEWAY_CONFIG"
}
prepare_java_gateway() {

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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"]

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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-<version>`
## `zabbix-proxy-mysql:ol-<version>`
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.

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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-<version>`
## `zabbix-proxy-sqlite3:ol-<version>`
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.

View File

@ -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 && \

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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"]

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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 <alexey.pustovalov@zabbix.com>" \
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

View File

@ -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-<version>`
## `zabbix-server-mysql:ol-<version>`
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.

Some files were not shown because too many files have changed in this diff Show More