Skip to content

Commit a1b1bcf

Browse files
authored
docker build version fixups (#241)
fixups to allow non-buildkit docker build to work
1 parent 472d049 commit a1b1bcf

File tree

6 files changed

+31
-11
lines changed

6 files changed

+31
-11
lines changed

docker/benchbase/build-dev-image.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ cd "$scriptdir"
77
. ./common-env.sh
88

99
set -x
10-
# See comments in devcontainer/Dockerfile explaining /dev/null build context.
11-
docker build --progress=plain \
12-
--build-arg="http_proxy=${http_proxy:-}" --build-arg="https_proxy=${https_proxy:-}" \
10+
# See comments in devcontainer/Dockerfile explaining empty build context (/dev/null or empty tmpdir).
11+
tmpdir=$(mktemp -d)
12+
docker build $docker_build_args \
13+
--build-arg BUILDKIT_INLINE_CACHE=1 \
14+
--build-arg="http_proxy=${http_proxy:-}" --build-arg="https_proxy=${https_proxy:-}" --build-arg="no_proxy=${no_proxy:-}" \
1315
--build-arg MAVEN_OPTS="-Dhttp.proxyHost=${http_proxy_host} -Dhttp.proxyPort=${http_proxy_port} -Dhttps.proxyHost=${https_proxy_host} -Dhttps.proxyPort=${https_proxy_port}" \
1416
--build-arg BENCHBASE_PROFILES="${BENCHBASE_PROFILES}" \
1517
--build-arg CONTAINERUSER_UID="$CONTAINERUSER_UID" --build-arg CONTAINERUSER_GID="$CONTAINERUSER_GID" \
16-
--tag benchbase-dev:latest ${image_tag_args:-} -f ./devcontainer/Dockerfile /dev/null
18+
--tag benchbase-dev:latest ${image_tag_args:-} -f ./devcontainer/Dockerfile "$tmpdir"
19+
rmdir "$tmpdir"
1720
set +x

docker/benchbase/build-full-image.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cd "$scriptdir"
1111

1212
if [ "$CLEAN_BUILD" == 'true' ]; then
1313
grep '^FROM ' fullimage/Dockerfile \
14-
| sed -r -e 's/^FROM\s+//' -e 's/\s+AS \S+\s*$/ /' \
14+
| sed -r -e 's/^FROM\s+//' -e 's/--platform=\S+\s+//' -e 's/\s+AS \S+\s*$/ /' \
1515
| while read base_image; do
1616
set -x
1717
docker pull $base_image &
@@ -79,8 +79,9 @@ function create_image() {
7979
local target_image_tag_args=$(echo "-t benchbase:latest ${image_tag_args:-}" | sed "s/benchbase:/$image_name:/g")
8080

8181
set -x
82-
docker build --progress=plain \
83-
--build-arg="http_proxy=${http_proxy:-}" --build-arg="https_proxy=${https_proxy:-}" \
82+
docker build $docker_build_args \
83+
--build-arg BUILDKIT_INLINE_CACHE=1 \
84+
--build-arg="http_proxy=${http_proxy:-}" --build-arg="https_proxy=${https_proxy:-}" --build-arg="no_proxy=${no_proxy:-}" \
8485
--build-arg CONTAINERUSER_UID="$CONTAINERUSER_UID" --build-arg CONTAINERUSER_GID="$CONTAINERUSER_GID" \
8586
$target_image_tag_args -f "$scriptdir/fullimage/Dockerfile" "$scriptdir/fullimage/tmp/"
8687
set +x

docker/benchbase/common-env.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,17 @@ if [ -n "$git_vers_tag" ]; then
6969
image_tag_args+=" -t $CONTAINER_REGISTRY_NAME/$imagename:$git_vers_tag"
7070
fi
7171
fi
72+
73+
docker_build_args=''
74+
if ! docker buildx version >/dev/null 2>&1; then
75+
echo 'NOTE: docker buildkit is unavailable.' >&2
76+
DOCKER_BUILDKIT=0
77+
docker_build_args=''
78+
elif [ -z "$DOCKER_BUILDKIT" ]; then
79+
# If not already set, default to buildkit.
80+
DOCKER_BUILDKIT=1
81+
fi
82+
if [ "$DOCKER_BUILDKIT" == 1 ]; then
83+
docker_build_args='--progress=plain'
84+
fi
85+
export DOCKER_BUILDKIT

docker/benchbase/devcontainer/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# For the devcontainer we need a full JDK.
2-
FROM --platform=linux maven:3.8.5-eclipse-temurin-17 AS devcontainer
2+
#FROM --platform=linux maven:3.8.5-eclipse-temurin-17 AS devcontainer
3+
FROM maven:3.8.5-eclipse-temurin-17 AS devcontainer
34

45
LABEL org.opencontainers.image.source = "https://github.com/cmu-db/benchbase/"
56

docker/benchbase/fullimage/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Use a smaller base image that only has the jre, not the full jdk.
2-
FROM --platform=linux eclipse-temurin:17-jre AS fullimage
2+
#FROM --platform=linux eclipse-temurin:17-jre AS fullimage
3+
FROM eclipse-temurin:17-jre AS fullimage
34

45
LABEL org.opencontainers.image.source = "https://github.com/cmu-db/benchbase/"
56

docker/benchbase/run-dev-image.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ rootdir=$(readlink -f "$scriptdir/../../")
99

1010
cd "$scriptdir"
1111
. ./common-env.sh
12-
./build-dev-image.sh
12+
./build-dev-image.sh >&2
1313

1414
if [ "$imagename" != 'benchbase-dev' ]; then
1515
echo "ERROR: Unexpected imagename: $imagename" >&2
@@ -30,7 +30,7 @@ MAVEN_CONFIG="${MAVEN_CONFIG:-$HOME/.m2}"
3030
mkdir -p "$MAVEN_CONFIG"
3131
set -x
3232
docker run ${INTERACTIVE_ARGS:-} --rm \
33-
--env=http_proxy="${http_proxy:-}" --env=https_proxy="${https_proxy:-}" \
33+
--env=http_proxy="${http_proxy:-}" --env=https_proxy="${https_proxy:-}" --env=no_proxy="${no_proxy:-}" \
3434
--env MAVEN_OPTS="-Dhttp.proxyHost=${http_proxy_host} -Dhttp.proxyPort=${http_proxy_port} -Dhttps.proxyHost=${https_proxy_host} -Dhttps.proxyPort=${https_proxy_port}" \
3535
--env BENCHBASE_PROFILES="$BENCHBASE_PROFILES" \
3636
--env CLEAN_BUILD="$CLEAN_BUILD" \

0 commit comments

Comments
 (0)