summaryrefslogtreecommitdiff
path: root/manage
diff options
context:
space:
mode:
Diffstat (limited to 'manage')
-rwxr-xr-xmanage27
1 files changed, 21 insertions, 6 deletions
diff --git a/manage b/manage
index 3ff1a6f88..3282cc645 100755
--- a/manage
+++ b/manage
@@ -152,6 +152,10 @@ docker.push() {
docker.build push
}
+docker.buildx() {
+ docker.build buildx
+}
+
# shellcheck disable=SC2119
docker.build() {
pyenv.install
@@ -210,23 +214,34 @@ docker.build() {
GITHUB_USER=$(echo "${GIT_URL}" | sed 's/.*github\.com\/\([^\/]*\).*/\1/')
SEARX_IMAGE_NAME="${SEARX_IMAGE_NAME:-${GITHUB_USER:-searxng}/searxng}"
+ BUILD="build"
+ if [ "$1" = "buildx" ]; then
+ # buildx includes the push option
+ CACHE_TAG="${SEARX_IMAGE_NAME}:latest-build-cache"
+ BUILD="buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --push --cache-from=type=registry,ref=$CACHE_TAG --cache-to=type=registry,ref=$CACHE_TAG,mode=max"
+ shift
+ fi
+ build_msg DOCKER "Build command: ${BUILD}"
+
# build Docker image
build_msg DOCKER "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
- sudo docker build \
+ # shellcheck disable=SC2086
+ docker $BUILD \
+ --build-arg BASE_IMAGE="${DEPENDENCIES_IMAGE_NAME}" \
--build-arg GIT_URL="${GIT_URL}" \
--build-arg SEARX_GIT_VERSION="${SEARX_GIT_VERSION}" \
--build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \
--build-arg LABEL_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--build-arg LABEL_VCS_REF="$(git rev-parse HEAD)" \
--build-arg LABEL_VCS_URL="${GIT_URL}" \
- --build-arg TIMESTAMP_SETTINGS="$(git log -1 --format="%cd" --date=unix -- searx/settings.yml)" \
- --build-arg TIMESTAMP_UWSGI="$(git log -1 --format="%cd" --date=unix -- dockerfiles/uwsgi.ini)" \
+ --build-arg TIMESTAMP_SETTINGS="$(git log -1 --format="%cd" --date=unix -- searx/settings.yml)" \
+ --build-arg TIMESTAMP_UWSGI="$(git log -1 --format="%cd" --date=unix -- dockerfiles/uwsgi.ini)" \
-t "${SEARX_IMAGE_NAME}:latest" -t "${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}" .
if [ "$1" = "push" ]; then
- sudo docker push "${SEARX_IMAGE_NAME}:latest"
- sudo docker push "${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
- fi
+ docker push "${SEARX_IMAGE_NAME}:latest"
+ docker push "${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
+ fi
)
dump_return $?
}