Move sources directory and introduce additional build context

This commit is contained in:
Alexey Pustovalov 2024-12-24 20:53:06 +09:00
parent 4840ebfe80
commit 4a9c6eb3c6
37 changed files with 45 additions and 15 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ zbx_env*/
.*KEY_FILE
.*CA_FILE
Dockerfiles/*/rhel/secrets/*
sources/*

View File

@ -34,7 +34,7 @@ ENV ZBX_SOURCES_DIR=/tmp/zabbix-${ZBX_VERSION} ZBX_OUTPUT_DIR=/tmp/zabbix-${ZBX_
RUN --mount=type=cache,target=/root/.cache/go-build/ \
--mount=type=cache,target=/root/go/ \
--mount=type=bind,source=src/,target=/tmp/src \
--mount=from=sources,target=/tmp/src \
--mount=type=bind,source=patches/,target=/tmp/patches \
--mount=from=config_templates,target=/tmp/conf \
set -eux && \

View File

@ -34,7 +34,7 @@ ENV ZBX_SOURCES_DIR=/tmp/zabbix-${ZBX_VERSION} ZBX_OUTPUT_DIR=/tmp/zabbix-${ZBX_
RUN --mount=type=cache,target=/root/.cache/go-build/ \
--mount=type=cache,target=/root/go/ \
--mount=type=bind,source=src/,target=/tmp/src \
--mount=from=sources,target=/tmp/src \
--mount=type=bind,source=patches/,target=/tmp/patches \
--mount=from=config_templates,target=/tmp/conf \
set -eux && \

View File

@ -34,7 +34,7 @@ ENV ZBX_SOURCES_DIR=/tmp/zabbix-${ZBX_VERSION} ZBX_OUTPUT_DIR=/tmp/zabbix-${ZBX_
RUN --mount=type=cache,target=/root/.cache/go-build/ \
--mount=type=cache,target=/root/go/ \
--mount=type=bind,source=src/,target=/tmp/src \
--mount=from=sources,target=/tmp/src \
--mount=type=bind,source=patches/,target=/tmp/patches \
--mount=from=config_templates,target=/tmp/conf \
set -eux && \

View File

@ -45,7 +45,7 @@ ENV ZBX_SOURCES_DIR=/tmp/zabbix-${ZBX_VERSION} ZBX_OUTPUT_DIR=/tmp/zabbix-${ZBX_
RUN --mount=type=cache,target=/root/.cache/go-build/ \
--mount=type=cache,target=/root/go/ \
--mount=type=bind,source=src/,target=/tmp/src \
--mount=from=sources,target=/tmp/src \
--mount=type=bind,source=patches/,target=/tmp/patches \
--mount=from=config_templates,target=/tmp/conf \
set -eux && \

View File

@ -34,7 +34,7 @@ ENV ZBX_SOURCES_DIR=/tmp/zabbix-${ZBX_VERSION} ZBX_OUTPUT_DIR=/tmp/zabbix-${ZBX_
RUN --mount=type=cache,target=/root/.cache/go-build/ \
--mount=type=cache,target=/root/go/ \
--mount=type=bind,source=src/,target=/tmp/src \
--mount=from=sources,target=/tmp/src \
--mount=type=bind,source=patches/,target=/tmp/patches \
--mount=from=config_templates,target=/tmp/conf \
set -eux && \

View File

@ -34,7 +34,7 @@ ENV ZBX_SOURCES_DIR=/tmp/zabbix-${ZBX_VERSION} ZBX_OUTPUT_DIR=/tmp/zabbix-${ZBX_
RUN --mount=type=cache,target=/root/.cache/go-build/ \
--mount=type=cache,target=/root/go/ \
--mount=type=bind,source=src/,target=/tmp/src \
--mount=from=sources,target=/tmp/src \
--mount=type=bind,source=patches/,target=/tmp/patches \
--mount=from=config_templates,target=/tmp/conf \
set -eux && \

View File

@ -34,7 +34,7 @@ ENV ZBX_SOURCES_DIR=/tmp/zabbix-${ZBX_VERSION} ZBX_OUTPUT_DIR=/tmp/zabbix-${ZBX_
RUN --mount=type=cache,target=/root/.cache/go-build/ \
--mount=type=cache,target=/root/go/ \
--mount=type=bind,source=src/,target=/tmp/src \
--mount=from=sources,target=/tmp/src \
--mount=type=bind,source=patches/,target=/tmp/patches \
--mount=from=config_templates,target=/tmp/conf \
set -eux && \

View File

@ -34,7 +34,7 @@ ENV ZBX_SOURCES_DIR=/tmp/zabbix-${ZBX_VERSION} ZBX_OUTPUT_DIR=/tmp/zabbix-${ZBX_
RUN --mount=type=cache,target=/root/.cache/go-build/ \
--mount=type=cache,target=/root/go/ \
--mount=type=bind,source=src/,target=/tmp/src \
--mount=from=sources,target=/tmp/src \
--mount=type=bind,source=patches/,target=/tmp/patches \
--mount=from=config_templates,target=/tmp/conf \
set -eux && \

View File

@ -45,9 +45,14 @@ ENV ZBX_SOURCES_DIR=/tmp/zabbix-${ZBX_VERSION} ZBX_OUTPUT_DIR=/tmp/zabbix-${ZBX_
RUN --mount=type=cache,target=/root/.cache/go-build/ \
--mount=type=cache,target=/root/go/ \
<<<<<<< HEAD
--mount=type=bind,source=src/,target=/tmp/src \
--mount=type=bind,source=patches/,target=/tmp/patches \
--mount=from=config_templates,target=/tmp/conf \
=======
--mount=from=sources,target=/tmp/src \
--mount=type=bind,source=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \
>>>>>>> b0f7df6f6 (Move sources directory and introduce additional build context)
set -eux && \
cd /tmp/ && \
mkdir -p ${ZBX_OUTPUT_DIR}/agent/sbin/ && \

View File

@ -34,7 +34,7 @@ ENV ZBX_SOURCES_DIR=/tmp/zabbix-${ZBX_VERSION} ZBX_OUTPUT_DIR=/tmp/zabbix-${ZBX_
RUN --mount=type=cache,target=/root/.cache/go-build/ \
--mount=type=cache,target=/root/go/ \
--mount=type=bind,source=src/,target=/tmp/src \
--mount=from=sources,target=/tmp/src \
--mount=type=bind,source=patches/,target=/tmp/patches \
--mount=from=config_templates,target=/tmp/conf \
set -eux && \

View File

@ -34,7 +34,7 @@ ENV ZBX_SOURCES_DIR=/tmp/zabbix-${ZBX_VERSION} ZBX_OUTPUT_DIR=/tmp/zabbix-${ZBX_
RUN --mount=type=cache,target=/root/.cache/go-build/ \
--mount=type=cache,target=/root/go/ \
--mount=type=bind,source=src/,target=/tmp/src \
--mount=from=sources,target=/tmp/src \
--mount=type=bind,source=patches/,target=/tmp/patches \
--mount=from=config_templates,target=/tmp/conf \
set -eux && \

View File

@ -34,7 +34,7 @@ ENV ZBX_SOURCES_DIR=/tmp/zabbix-${ZBX_VERSION} ZBX_OUTPUT_DIR=/tmp/zabbix-${ZBX_
RUN --mount=type=cache,target=/root/.cache/go-build/ \
--mount=type=cache,target=/root/go/ \
--mount=type=bind,source=src/,target=/tmp/src \
--mount=from=sources,target=/tmp/src \
--mount=type=bind,source=patches/,target=/tmp/patches \
--mount=from=config_templates,target=/tmp/conf \
set -eux && \

View File

@ -34,7 +34,7 @@ ENV ZBX_SOURCES_DIR=/tmp/zabbix-${ZBX_VERSION} ZBX_OUTPUT_DIR=/tmp/zabbix-${ZBX_
RUN --mount=type=cache,target=/root/.cache/go-build/ \
--mount=type=cache,target=/root/go/ \
--mount=type=bind,source=src/,target=/tmp/src \
--mount=from=sources,target=/tmp/src \
--mount=type=bind,source=patches/,target=/tmp/patches \
--mount=from=config_templates,target=/tmp/conf \
set -eux && \

View File

@ -45,7 +45,7 @@ ENV ZBX_SOURCES_DIR=/tmp/zabbix-${ZBX_VERSION} ZBX_OUTPUT_DIR=/tmp/zabbix-${ZBX_
RUN --mount=type=cache,target=/root/.cache/go-build/ \
--mount=type=cache,target=/root/go/ \
--mount=type=bind,source=src/,target=/tmp/src \
--mount=from=sources,target=/tmp/src \
--mount=type=bind,source=patches/,target=/tmp/patches \
--mount=from=config_templates,target=/tmp/conf \
set -eux && \

View File

@ -34,7 +34,7 @@ ENV ZBX_SOURCES_DIR=/tmp/zabbix-${ZBX_VERSION} ZBX_OUTPUT_DIR=/tmp/zabbix-${ZBX_
RUN --mount=type=cache,target=/root/.cache/go-build/ \
--mount=type=cache,target=/root/go/ \
--mount=type=bind,source=src/,target=/tmp/src \
--mount=from=sources,target=/tmp/src \
--mount=type=bind,source=patches/,target=/tmp/patches \
--mount=from=config_templates,target=/tmp/conf \
set -eux && \

View File

@ -42,7 +42,12 @@ else
exit 1
fi
DOCKER_BUILDKIT=1 $exec_command build -t "zabbix-$app_component:$os-$version" --build-context config_templates="../../../config_templates" --build-arg VCS_REF="$VCS_REF" --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" -f Dockerfile .
DOCKER_BUILDKIT=1 $exec_command build -t "zabbix-$app_component:$os-$version" \
--build-context sources="../../../sources" \
--build-context config_templates="../../../config_templates" \
--build-arg VCS_REF="$VCS_REF" \
--build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
-f Dockerfile .
if [ "$type" != "build" ]; then
links=""

View File

@ -14,6 +14,7 @@ services:
context: ./Dockerfiles/build-mysql/${ALPINE_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${ALPINE_CACHE_FROM}"
args:
@ -28,6 +29,7 @@ services:
context: ./Dockerfiles/build-sqlite3/${ALPINE_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${ALPINE_CACHE_FROM}"
args:

View File

@ -12,6 +12,7 @@ services:
context: ./Dockerfiles/build-pgsql/${ALPINE_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${ALPINE_CACHE_FROM}"
args:
@ -26,6 +27,7 @@ services:
context: ./Dockerfiles/build-mysql/${ALPINE_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${ALPINE_CACHE_FROM}"
args:
@ -42,6 +44,7 @@ services:
context: ./Dockerfiles/build-sqlite3/${ALPINE_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${ALPINE_CACHE_FROM}"
args:

View File

@ -14,6 +14,7 @@ services:
context: ./Dockerfiles/build-mysql/${CENTOS_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${CENTOS_CACHE_FROM}"
args:
@ -28,6 +29,7 @@ services:
context: ./Dockerfiles/build-sqlite3/${CENTOS_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${CENTOS_CACHE_FROM}"
args:

View File

@ -12,6 +12,7 @@ services:
context: ./Dockerfiles/build-pgsql/${CENTOS_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${CENTOS_CACHE_FROM}"
args:
@ -26,6 +27,7 @@ services:
context: ./Dockerfiles/build-mysql/${CENTOS_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${CENTOS_CACHE_FROM}"
args:

View File

@ -12,6 +12,7 @@ services:
context: ./Dockerfiles/build-mysql/${OL_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${OL_CACHE_FROM}"
args:
@ -26,6 +27,7 @@ services:
context: ./Dockerfiles/build-sqlite3/${OL_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${OL_CACHE_FROM}"
args:

View File

@ -12,6 +12,7 @@ services:
context: ./Dockerfiles/build-pgsql/${OL_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${OL_CACHE_FROM}"
args:
@ -26,6 +27,7 @@ services:
context: ./Dockerfiles/build-mysql/${OL_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${OL_CACHE_FROM}"
args:
@ -42,6 +44,7 @@ services:
context: ./Dockerfiles/build-sqlite3/${OL_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${OL_CACHE_FROM}"
args:

View File

@ -12,6 +12,7 @@ services:
context: ./Dockerfiles/build-mysql/${UBUNTU_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${UBUNTU_CACHE_FROM}"
args:
@ -26,6 +27,7 @@ services:
context: ./Dockerfiles/build-sqlite3/${UBUNTU_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${UBUNTU_CACHE_FROM}"
args:

View File

@ -12,6 +12,7 @@ services:
context: ./Dockerfiles/build-pgsql/${UBUNTU_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${UBUNTU_CACHE_FROM}"
args:
@ -26,6 +27,7 @@ services:
context: ./Dockerfiles/build-mysql/${UBUNTU_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${UBUNTU_CACHE_FROM}"
args:
@ -42,6 +44,7 @@ services:
context: ./Dockerfiles/build-sqlite3/${UBUNTU_OS_TAG_SHORT}
additional_contexts:
- config_templates=./config_templates/
- sources=./sources/
cache_from:
- "${UBUNTU_CACHE_FROM}"
args: