From 9e98b9fbf7a7c39846e0193b02365e0dbdea64ec Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Wed, 14 Aug 2024 16:40:30 +0900 Subject: [PATCH] Added possibility to build images from local source direactory --- Dockerfiles/build-mysql/alpine/Dockerfile | 7 ++++++- Dockerfiles/build-mysql/centos/Dockerfile | 7 ++++++- Dockerfiles/build-mysql/ol/Dockerfile | 7 ++++++- Dockerfiles/build-mysql/rhel/Dockerfile | 7 ++++++- Dockerfiles/build-mysql/ubuntu/Dockerfile | 7 ++++++- Dockerfiles/build-pgsql/alpine/Dockerfile | 7 ++++++- Dockerfiles/build-pgsql/centos/Dockerfile | 7 ++++++- Dockerfiles/build-pgsql/ol/Dockerfile | 7 ++++++- Dockerfiles/build-pgsql/rhel/Dockerfile | 7 ++++++- Dockerfiles/build-pgsql/ubuntu/Dockerfile | 7 ++++++- Dockerfiles/build-sqlite3/alpine/Dockerfile | 7 ++++++- Dockerfiles/build-sqlite3/centos/Dockerfile | 7 ++++++- Dockerfiles/build-sqlite3/ol/Dockerfile | 7 ++++++- Dockerfiles/build-sqlite3/rhel/Dockerfile | 7 ++++++- Dockerfiles/build-sqlite3/ubuntu/Dockerfile | 7 ++++++- 15 files changed, 90 insertions(+), 15 deletions(-) diff --git a/Dockerfiles/build-mysql/alpine/Dockerfile b/Dockerfiles/build-mysql/alpine/Dockerfile index eaa444d9a..33e74f6d6 100644 --- a/Dockerfiles/build-mysql/alpine/Dockerfile +++ b/Dockerfiles/build-mysql/alpine/Dockerfile @@ -28,6 +28,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=type=bind,source=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \ set -eux && \ cd /tmp/ && \ @@ -48,7 +49,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/general/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/bin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/conf/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR} && \ + if [ -f "/tmp/src/bootstrap.sh" ]; then \ + cp -R /tmp/src ${ZBX_SOURCES_DIR}; \ + else \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR}; \ + fi && \ cd ${ZBX_SOURCES_DIR} && \ patch -p1 < /tmp/chromedp_no_sandbox.patch && \ zabbix_revision=`git rev-parse --short HEAD` && \ diff --git a/Dockerfiles/build-mysql/centos/Dockerfile b/Dockerfiles/build-mysql/centos/Dockerfile index 11d80826a..ae57e3c92 100644 --- a/Dockerfiles/build-mysql/centos/Dockerfile +++ b/Dockerfiles/build-mysql/centos/Dockerfile @@ -28,6 +28,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=type=bind,source=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \ set -eux && \ cd /tmp/ && \ @@ -48,7 +49,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/general/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/bin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/conf/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR} && \ + if [ -f "/tmp/src/bootstrap.sh" ]; then \ + cp -R /tmp/src ${ZBX_SOURCES_DIR}; \ + else \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR}; \ + fi && \ cd ${ZBX_SOURCES_DIR} && \ patch -p1 < /tmp/chromedp_no_sandbox.patch && \ zabbix_revision=`git rev-parse --short HEAD` && \ diff --git a/Dockerfiles/build-mysql/ol/Dockerfile b/Dockerfiles/build-mysql/ol/Dockerfile index a01601d44..7a559817d 100644 --- a/Dockerfiles/build-mysql/ol/Dockerfile +++ b/Dockerfiles/build-mysql/ol/Dockerfile @@ -28,6 +28,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=type=bind,source=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \ set -eux && \ cd /tmp/ && \ @@ -48,7 +49,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/general/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/bin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/conf/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR} && \ + if [ -f "/tmp/src/bootstrap.sh" ]; then \ + cp -R /tmp/src ${ZBX_SOURCES_DIR}; \ + else \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR}; \ + fi && \ cd ${ZBX_SOURCES_DIR} && \ patch -p1 < /tmp/chromedp_no_sandbox.patch && \ zabbix_revision=`git rev-parse --short HEAD` && \ diff --git a/Dockerfiles/build-mysql/rhel/Dockerfile b/Dockerfiles/build-mysql/rhel/Dockerfile index 163b568a1..fdeba20e8 100644 --- a/Dockerfiles/build-mysql/rhel/Dockerfile +++ b/Dockerfiles/build-mysql/rhel/Dockerfile @@ -38,6 +38,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=type=bind,source=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \ set -eux && \ cd /tmp/ && \ @@ -58,7 +59,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/general/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/bin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/conf/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR} && \ + if [ -f "/tmp/src/bootstrap.sh" ]; then \ + cp -R /tmp/src ${ZBX_SOURCES_DIR}; \ + else \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR}; \ + fi && \ cd ${ZBX_SOURCES_DIR} && \ patch -p1 < /tmp/chromedp_no_sandbox.patch && \ zabbix_revision=`git rev-parse --short HEAD` && \ diff --git a/Dockerfiles/build-mysql/ubuntu/Dockerfile b/Dockerfiles/build-mysql/ubuntu/Dockerfile index c4b157e2e..828ab069e 100644 --- a/Dockerfiles/build-mysql/ubuntu/Dockerfile +++ b/Dockerfiles/build-mysql/ubuntu/Dockerfile @@ -28,6 +28,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=type=bind,source=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \ set -eux && \ cd /tmp/ && \ @@ -48,7 +49,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/general/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/bin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/conf/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR} && \ + if [ -f "/tmp/src/bootstrap.sh" ]; then \ + cp -R /tmp/src ${ZBX_SOURCES_DIR}; \ + else \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR}; \ + fi && \ cd ${ZBX_SOURCES_DIR} && \ patch -p1 < /tmp/chromedp_no_sandbox.patch && \ zabbix_revision=`git rev-parse --short HEAD` && \ diff --git a/Dockerfiles/build-pgsql/alpine/Dockerfile b/Dockerfiles/build-pgsql/alpine/Dockerfile index 8d94fde3c..93cc512b2 100644 --- a/Dockerfiles/build-pgsql/alpine/Dockerfile +++ b/Dockerfiles/build-pgsql/alpine/Dockerfile @@ -28,6 +28,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=type=bind,source=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \ set -eux && \ cd /tmp/ && \ @@ -50,7 +51,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/general/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/bin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/conf/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR} && \ + if [ -f "/tmp/src/bootstrap.sh" ]; then \ + cp -R /tmp/src ${ZBX_SOURCES_DIR}; \ + else \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR}; \ + fi && \ cd ${ZBX_SOURCES_DIR} && \ patch -p1 < /tmp/chromedp_no_sandbox.patch && \ zabbix_revision=`git rev-parse --short HEAD` && \ diff --git a/Dockerfiles/build-pgsql/centos/Dockerfile b/Dockerfiles/build-pgsql/centos/Dockerfile index b1aa71e1c..5e2b92c49 100644 --- a/Dockerfiles/build-pgsql/centos/Dockerfile +++ b/Dockerfiles/build-pgsql/centos/Dockerfile @@ -28,6 +28,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=type=bind,source=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \ set -eux && \ cd /tmp/ && \ @@ -50,7 +51,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/general/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/bin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/conf/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR} && \ + if [ -f "/tmp/src/bootstrap.sh" ]; then \ + cp -R /tmp/src ${ZBX_SOURCES_DIR}; \ + else \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR}; \ + fi && \ cd ${ZBX_SOURCES_DIR} && \ patch -p1 < /tmp/chromedp_no_sandbox.patch && \ zabbix_revision=`git rev-parse --short HEAD` && \ diff --git a/Dockerfiles/build-pgsql/ol/Dockerfile b/Dockerfiles/build-pgsql/ol/Dockerfile index a2f9877e0..f24d5feb7 100644 --- a/Dockerfiles/build-pgsql/ol/Dockerfile +++ b/Dockerfiles/build-pgsql/ol/Dockerfile @@ -28,6 +28,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=type=bind,source=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \ set -eux && \ cd /tmp/ && \ @@ -50,7 +51,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/general/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/bin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/conf/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR} && \ + if [ -f "/tmp/src/bootstrap.sh" ]; then \ + cp -R /tmp/src ${ZBX_SOURCES_DIR}; \ + else \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR}; \ + fi && \ cd ${ZBX_SOURCES_DIR} && \ patch -p1 < /tmp/chromedp_no_sandbox.patch && \ zabbix_revision=`git rev-parse --short HEAD` && \ diff --git a/Dockerfiles/build-pgsql/rhel/Dockerfile b/Dockerfiles/build-pgsql/rhel/Dockerfile index 3baac9c18..7831cb36f 100644 --- a/Dockerfiles/build-pgsql/rhel/Dockerfile +++ b/Dockerfiles/build-pgsql/rhel/Dockerfile @@ -38,6 +38,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=type=bind,source=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \ set -eux && \ cd /tmp/ && \ @@ -60,7 +61,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/general/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/bin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/conf/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR} && \ + if [ -f "/tmp/src/bootstrap.sh" ]; then \ + cp -R /tmp/src ${ZBX_SOURCES_DIR}; \ + else \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR}; \ + fi && \ cd ${ZBX_SOURCES_DIR} && \ patch -p1 < /tmp/chromedp_no_sandbox.patch && \ zabbix_revision=`git rev-parse --short HEAD` && \ diff --git a/Dockerfiles/build-pgsql/ubuntu/Dockerfile b/Dockerfiles/build-pgsql/ubuntu/Dockerfile index bc4f68b64..a2a5687e5 100644 --- a/Dockerfiles/build-pgsql/ubuntu/Dockerfile +++ b/Dockerfiles/build-pgsql/ubuntu/Dockerfile @@ -28,6 +28,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=type=bind,source=conf/chromedp_no_sandbox.patch,target=/tmp/chromedp_no_sandbox.patch \ set -eux && \ cd /tmp/ && \ @@ -50,7 +51,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/general/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/bin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/conf/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR} && \ + if [ -f "/tmp/src/bootstrap.sh" ]; then \ + cp -R /tmp/src ${ZBX_SOURCES_DIR}; \ + else \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR}; \ + fi && \ cd ${ZBX_SOURCES_DIR} && \ patch -p1 < /tmp/chromedp_no_sandbox.patch && \ zabbix_revision=`git rev-parse --short HEAD` && \ diff --git a/Dockerfiles/build-sqlite3/alpine/Dockerfile b/Dockerfiles/build-sqlite3/alpine/Dockerfile index ed4e514c2..0b30cef64 100644 --- a/Dockerfiles/build-sqlite3/alpine/Dockerfile +++ b/Dockerfiles/build-sqlite3/alpine/Dockerfile @@ -28,6 +28,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 \ set -eux && \ cd /tmp/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/agent/sbin/ && \ @@ -41,7 +42,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/general/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/bin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/conf/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR} && \ + if [ -f "/tmp/src/bootstrap.sh" ]; then \ + cp -R /tmp/src ${ZBX_SOURCES_DIR}; \ + else \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR}; \ + fi && \ cd ${ZBX_SOURCES_DIR} && \ zabbix_revision=`git rev-parse --short HEAD` && \ sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ diff --git a/Dockerfiles/build-sqlite3/centos/Dockerfile b/Dockerfiles/build-sqlite3/centos/Dockerfile index 3164705d9..6f2831d48 100644 --- a/Dockerfiles/build-sqlite3/centos/Dockerfile +++ b/Dockerfiles/build-sqlite3/centos/Dockerfile @@ -28,6 +28,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 \ set -eux && \ cd /tmp/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/agent/sbin/ && \ @@ -41,7 +42,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/general/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/bin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/conf/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR} && \ + if [ -f "/tmp/src/bootstrap.sh" ]; then \ + cp -R /tmp/src ${ZBX_SOURCES_DIR}; \ + else \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR}; \ + fi && \ cd ${ZBX_SOURCES_DIR} && \ zabbix_revision=`git rev-parse --short HEAD` && \ sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ diff --git a/Dockerfiles/build-sqlite3/ol/Dockerfile b/Dockerfiles/build-sqlite3/ol/Dockerfile index bc0b7a06c..25f93ad92 100644 --- a/Dockerfiles/build-sqlite3/ol/Dockerfile +++ b/Dockerfiles/build-sqlite3/ol/Dockerfile @@ -28,6 +28,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 \ set -eux && \ cd /tmp/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/agent/sbin/ && \ @@ -41,7 +42,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/general/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/bin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/conf/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR} && \ + if [ -f "/tmp/src/bootstrap.sh" ]; then \ + cp -R /tmp/src ${ZBX_SOURCES_DIR}; \ + else \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR}; \ + fi && \ cd ${ZBX_SOURCES_DIR} && \ zabbix_revision=`git rev-parse --short HEAD` && \ sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ diff --git a/Dockerfiles/build-sqlite3/rhel/Dockerfile b/Dockerfiles/build-sqlite3/rhel/Dockerfile index 32e578ee6..7afe80c78 100644 --- a/Dockerfiles/build-sqlite3/rhel/Dockerfile +++ b/Dockerfiles/build-sqlite3/rhel/Dockerfile @@ -38,6 +38,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 \ set -eux && \ cd /tmp/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/agent/sbin/ && \ @@ -51,7 +52,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/general/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/bin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/conf/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR} && \ + if [ -f "/tmp/src/bootstrap.sh" ]; then \ + cp -R /tmp/src ${ZBX_SOURCES_DIR}; \ + else \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR}; \ + fi && \ cd ${ZBX_SOURCES_DIR} && \ zabbix_revision=`git rev-parse --short HEAD` && \ sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ diff --git a/Dockerfiles/build-sqlite3/ubuntu/Dockerfile b/Dockerfiles/build-sqlite3/ubuntu/Dockerfile index 45615b61f..38ca45378 100644 --- a/Dockerfiles/build-sqlite3/ubuntu/Dockerfile +++ b/Dockerfiles/build-sqlite3/ubuntu/Dockerfile @@ -28,6 +28,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 \ set -eux && \ cd /tmp/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/agent/sbin/ && \ @@ -41,7 +42,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/general/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/bin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/general/conf/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR} && \ + if [ -f "/tmp/src/bootstrap.sh" ]; then \ + cp -R /tmp/src ${ZBX_SOURCES_DIR}; \ + else \ + git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR}; \ + fi && \ cd ${ZBX_SOURCES_DIR} && \ zabbix_revision=`git rev-parse --short HEAD` && \ sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \