Move sources directory and introduce additional build context

This commit is contained in:
Alexey Pustovalov 2024-12-24 20:53:06 +09:00
parent 9161d3b1dd
commit b0f7df6f69
36 changed files with 54 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=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \
set -eux && \
cd /tmp/ && \

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=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \
set -eux && \
cd /tmp/ && \

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=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \
set -eux && \
cd /tmp/ && \

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=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \
set -eux && \
cd /tmp/ && \

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=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \
set -eux && \
cd /tmp/ && \

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=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \
set -eux && \
cd /tmp/ && \

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=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \
set -eux && \
cd /tmp/ && \

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=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \
set -eux && \
cd /tmp/ && \

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=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \
set -eux && \
cd /tmp/ && \

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=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \
set -eux && \
cd /tmp/ && \

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 \
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 \
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 \
set -eux && \
cd /tmp/ && \
mkdir -p ${ZBX_OUTPUT_DIR}/agent/sbin/ && \

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 \
set -eux && \
cd /tmp/ && \
mkdir -p ${ZBX_OUTPUT_DIR}/agent/sbin/ && \

View File

@ -42,7 +42,7 @@ else
exit 1
fi
DOCKER_BUILDKIT=1 $exec_command build -t "zabbix-$app_component:$os-$version" --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-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

@ -10,6 +10,8 @@ services:
zabbix-build-mysql:
build:
context: ./Dockerfiles/build-mysql/${ALPINE_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${ALPINE_CACHE_FROM}"
args:
@ -22,6 +24,8 @@ services:
zabbix-build-sqlite3:
build:
context: ./Dockerfiles/build-sqlite3/${ALPINE_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${ALPINE_CACHE_FROM}"
args:

View File

@ -10,6 +10,8 @@ services:
zabbix-build-pgsql:
build:
context: ./Dockerfiles/build-pgsql/${ALPINE_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${ALPINE_CACHE_FROM}"
args:
@ -22,6 +24,8 @@ services:
zabbix-build-mysql:
build:
context: ./Dockerfiles/build-mysql/${ALPINE_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${ALPINE_CACHE_FROM}"
args:
@ -36,6 +40,8 @@ services:
zabbix-build-sqlite3:
build:
context: ./Dockerfiles/build-sqlite3/${ALPINE_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${ALPINE_CACHE_FROM}"
args:

View File

@ -10,6 +10,8 @@ services:
zabbix-build-mysql:
build:
context: ./Dockerfiles/build-mysql/${CENTOS_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${CENTOS_CACHE_FROM}"
args:
@ -22,6 +24,8 @@ services:
zabbix-build-sqlite3:
build:
context: ./Dockerfiles/build-sqlite3/${CENTOS_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${CENTOS_CACHE_FROM}"
args:

View File

@ -10,6 +10,8 @@ services:
zabbix-build-pgsql:
build:
context: ./Dockerfiles/build-pgsql/${CENTOS_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${CENTOS_CACHE_FROM}"
args:
@ -22,6 +24,8 @@ services:
zabbix-build-mysql:
build:
context: ./Dockerfiles/build-mysql/${CENTOS_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${CENTOS_CACHE_FROM}"
args:

View File

@ -10,6 +10,8 @@ services:
zabbix-build-mysql:
build:
context: ./Dockerfiles/build-mysql/${OL_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${OL_CACHE_FROM}"
args:
@ -22,6 +24,8 @@ services:
zabbix-build-sqlite3:
build:
context: ./Dockerfiles/build-sqlite3/${OL_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${OL_CACHE_FROM}"
args:

View File

@ -10,6 +10,8 @@ services:
zabbix-build-pgsql:
build:
context: ./Dockerfiles/build-pgsql/${OL_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${OL_CACHE_FROM}"
args:
@ -22,6 +24,8 @@ services:
zabbix-build-mysql:
build:
context: ./Dockerfiles/build-mysql/${OL_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${OL_CACHE_FROM}"
args:
@ -36,6 +40,8 @@ services:
zabbix-build-sqlite3:
build:
context: ./Dockerfiles/build-sqlite3/${OL_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${OL_CACHE_FROM}"
args:

View File

@ -10,6 +10,8 @@ services:
zabbix-build-mysql:
build:
context: ./Dockerfiles/build-mysql/${UBUNTU_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${UBUNTU_CACHE_FROM}"
args:
@ -22,6 +24,8 @@ services:
zabbix-build-sqlite3:
build:
context: ./Dockerfiles/build-sqlite3/${UBUNTU_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${UBUNTU_CACHE_FROM}"
args:

View File

@ -10,6 +10,8 @@ services:
zabbix-build-pgsql:
build:
context: ./Dockerfiles/build-pgsql/${UBUNTU_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${UBUNTU_CACHE_FROM}"
args:
@ -22,6 +24,8 @@ services:
zabbix-build-mysql:
build:
context: ./Dockerfiles/build-mysql/${UBUNTU_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${UBUNTU_CACHE_FROM}"
args:
@ -36,6 +40,8 @@ services:
zabbix-build-sqlite3:
build:
context: ./Dockerfiles/build-sqlite3/${UBUNTU_OS_TAG_SHORT}
additional_contexts:
- sources=./sources/
cache_from:
- "${UBUNTU_CACHE_FROM}"
args: