ci: configure docker build proxy
This commit is contained in:
Vendored
+35
-2
@@ -15,6 +15,9 @@ pipeline {
|
|||||||
DOCKER_CREDS = 'harbor_key'
|
DOCKER_CREDS = 'harbor_key'
|
||||||
TARGET_PLATFORMS = 'linux/amd64,linux/arm64'
|
TARGET_PLATFORMS = 'linux/amd64,linux/arm64'
|
||||||
BUILDER_NAME = "liverecorder-buildx-${env.BUILD_ID}"
|
BUILDER_NAME = "liverecorder-buildx-${env.BUILD_ID}"
|
||||||
|
HTTP_PROXY = 'http://192.168.5.200:7890'
|
||||||
|
HTTPS_PROXY = 'http://192.168.5.200:7890'
|
||||||
|
NO_PROXY = '127.0.0.1,localhost,reg.nxsir.cn,gitea.nxsir.cn,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12'
|
||||||
|
|
||||||
GIT_REPO_URL = 'https://gitea.nxsir.cn/nanxun/live_recorder.git'
|
GIT_REPO_URL = 'https://gitea.nxsir.cn/nanxun/live_recorder.git'
|
||||||
GIT_BRANCH = 'main'
|
GIT_BRANCH = 'main'
|
||||||
@@ -51,8 +54,6 @@ pipeline {
|
|||||||
sudo docker buildx version
|
sudo docker buildx version
|
||||||
sudo docker run --privileged --rm tonistiigi/binfmt --install arm64
|
sudo docker run --privileged --rm tonistiigi/binfmt --install arm64
|
||||||
sudo docker buildx rm ${BUILDER_NAME} >/dev/null 2>&1 || true
|
sudo docker buildx rm ${BUILDER_NAME} >/dev/null 2>&1 || true
|
||||||
sudo docker buildx create --name ${BUILDER_NAME} --driver docker-container --use
|
|
||||||
sudo docker buildx inspect --builder ${BUILDER_NAME} --bootstrap
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,6 +79,16 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
sh """
|
sh """
|
||||||
set -e
|
set -e
|
||||||
|
if ! sudo docker buildx inspect --builder ${BUILDER_NAME} >/dev/null 2>&1; then
|
||||||
|
sudo docker buildx create \
|
||||||
|
--name ${BUILDER_NAME} \
|
||||||
|
--driver docker-container \
|
||||||
|
--driver-opt env.http_proxy=${HTTP_PROXY} \
|
||||||
|
--driver-opt env.https_proxy=${HTTPS_PROXY} \
|
||||||
|
--driver-opt env.no_proxy=${NO_PROXY} \
|
||||||
|
--use
|
||||||
|
fi
|
||||||
|
sudo docker buildx inspect --builder ${BUILDER_NAME} --bootstrap >/dev/null
|
||||||
echo 'Building and pushing multi-arch API image: ${API_IMAGE_TAGGED}'
|
echo 'Building and pushing multi-arch API image: ${API_IMAGE_TAGGED}'
|
||||||
sudo docker buildx build \
|
sudo docker buildx build \
|
||||||
--builder ${BUILDER_NAME} \
|
--builder ${BUILDER_NAME} \
|
||||||
@@ -85,6 +96,12 @@ pipeline {
|
|||||||
--pull \
|
--pull \
|
||||||
--network host \
|
--network host \
|
||||||
--provenance=false \
|
--provenance=false \
|
||||||
|
--build-arg HTTP_PROXY=${HTTP_PROXY} \
|
||||||
|
--build-arg HTTPS_PROXY=${HTTPS_PROXY} \
|
||||||
|
--build-arg NO_PROXY=${NO_PROXY} \
|
||||||
|
--build-arg http_proxy=${HTTP_PROXY} \
|
||||||
|
--build-arg https_proxy=${HTTPS_PROXY} \
|
||||||
|
--build-arg no_proxy=${NO_PROXY} \
|
||||||
-f src/LiveRecorder.WebApi/Dockerfile \
|
-f src/LiveRecorder.WebApi/Dockerfile \
|
||||||
-t ${API_IMAGE_TAGGED} \
|
-t ${API_IMAGE_TAGGED} \
|
||||||
-t ${API_IMAGE_LATEST} \
|
-t ${API_IMAGE_LATEST} \
|
||||||
@@ -98,6 +115,16 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
sh """
|
sh """
|
||||||
set -e
|
set -e
|
||||||
|
if ! sudo docker buildx inspect --builder ${BUILDER_NAME} >/dev/null 2>&1; then
|
||||||
|
sudo docker buildx create \
|
||||||
|
--name ${BUILDER_NAME} \
|
||||||
|
--driver docker-container \
|
||||||
|
--driver-opt env.http_proxy=${HTTP_PROXY} \
|
||||||
|
--driver-opt env.https_proxy=${HTTPS_PROXY} \
|
||||||
|
--driver-opt env.no_proxy=${NO_PROXY} \
|
||||||
|
--use
|
||||||
|
fi
|
||||||
|
sudo docker buildx inspect --builder ${BUILDER_NAME} --bootstrap >/dev/null
|
||||||
echo 'Building and pushing multi-arch Web image: ${WEB_IMAGE_TAGGED}'
|
echo 'Building and pushing multi-arch Web image: ${WEB_IMAGE_TAGGED}'
|
||||||
sudo docker buildx build \
|
sudo docker buildx build \
|
||||||
--builder ${BUILDER_NAME} \
|
--builder ${BUILDER_NAME} \
|
||||||
@@ -105,6 +132,12 @@ pipeline {
|
|||||||
--pull \
|
--pull \
|
||||||
--network host \
|
--network host \
|
||||||
--provenance=false \
|
--provenance=false \
|
||||||
|
--build-arg HTTP_PROXY=${HTTP_PROXY} \
|
||||||
|
--build-arg HTTPS_PROXY=${HTTPS_PROXY} \
|
||||||
|
--build-arg NO_PROXY=${NO_PROXY} \
|
||||||
|
--build-arg http_proxy=${HTTP_PROXY} \
|
||||||
|
--build-arg https_proxy=${HTTPS_PROXY} \
|
||||||
|
--build-arg no_proxy=${NO_PROXY} \
|
||||||
-f frontend/Dockerfile \
|
-f frontend/Dockerfile \
|
||||||
--build-arg VITE_API_BASE_URL=/api \
|
--build-arg VITE_API_BASE_URL=/api \
|
||||||
-t ${WEB_IMAGE_TAGGED} \
|
-t ${WEB_IMAGE_TAGGED} \
|
||||||
|
|||||||
Reference in New Issue
Block a user