From 3c59438fae7cab03a7e3a85cca70de433414a44c Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 8 Aug 2022 10:42:37 -0700 Subject: [PATCH] docker/alpine: Use build args for urls/versions. --- docker/alpine/3.16/built/Dockerfile | 19 ++++++++------- docker/build-and-push-images.sh | 36 +++++++---------------------- 2 files changed, 19 insertions(+), 36 deletions(-) diff --git a/docker/alpine/3.16/built/Dockerfile b/docker/alpine/3.16/built/Dockerfile index 4d8cb591c..81f686aaf 100644 --- a/docker/alpine/3.16/built/Dockerfile +++ b/docker/alpine/3.16/built/Dockerfile @@ -9,15 +9,18 @@ ARG cxx ARG extra_packages_dev ARG extra_packages_dev1 ARG extra_packages_dev2 - -ENV rocks_version 7.4.3 -ENV rocks_url https://codeload.github.com/facebook/rocksdb/tar.gz/refs/tags/v${rocks_version} -ENV ctor_url https://github.com/matrix-construct/construct +ARG rocksdb_version 7.4.3 +ARG rocksdb_url +ARG ctor_url https://github.com/matrix-construct/construct ENV CC ${cc} ENV CXX ${cxx} ENV CONFIG_SHELL bash +ENV rocksdb_version ${rocksdb_version} +ENV rocksdb_url https://codeload.github.com/facebook/rocksdb/tar.gz/refs/tags/v${rocksdb_version} +ENV ctor_url ${ctor_url} + ENV packages_dev="\ ${packages_dev} \ autoconf \ @@ -38,10 +41,10 @@ ${extra_packages_dev2} \ WORKDIR /usr/src RUN true \ && apk add --no-cache ${packages_dev} \ -&& curl -sL ${rocks_url} -o rocksdb-${rocks_version}.tar.gz \ -&& tar xfz rocksdb-${rocks_version}.tar.gz \ -&& rm -v rocksdb-${rocks_version}.tar.gz \ -&& mv -v rocksdb-${rocks_version} rocksdb \ +&& curl -sL ${rocksdb_url} -o rocksdb-${rocksdb_version}.tar.gz \ +&& tar xfz rocksdb-${rocksdb_version}.tar.gz \ +&& rm -v rocksdb-${rocksdb_version}.tar.gz \ +&& mv -v rocksdb-${rocksdb_version} rocksdb \ && git clone ${ctor_url} construct \ && rmdir -v construct/deps/rocksdb \ && ln -sv /usr/src/rocksdb construct/deps/rocksdb \ diff --git a/docker/build-and-push-images.sh b/docker/build-and-push-images.sh index 77e42e44a..b7b2b3585 100755 --- a/docker/build-and-push-images.sh +++ b/docker/build-and-push-images.sh @@ -3,11 +3,15 @@ BASEDIR=$(dirname "$0") ACCT=jevolk REPO=construct +ctor_url="https://github.com/matrix-construct/construct" +rocksdb_version=7.4.3 ARGS_="" ARGS_="$ARGS_ --compress=true" ARGS_="$ARGS_ --build-arg acct=$ACCT" ARGS_="$ARGS_ --build-arg repo=$REPO" +ARGS_="$ARGS_ --build-arg ctor_url=$ctor_url" +ARGS_="$ARGS_ --build-arg rocksdb_version=$rocksdb_version" export DOCKER_BUILDKIT=1 #export BUILDKIT_PROGRESS=plain @@ -34,7 +38,7 @@ ARGS="$ARGS --platform linux/amd64" docker build $ARGS -t $ACCT/$REPO:alpine-3.16-full-amd64 $BASEDIR/alpine/3.16/full # -# L2 - Built images +# L2/L3 - Built/Test images # ARGS="$ARGS_" @@ -44,6 +48,7 @@ ARGS="$ARGS --build-arg extra_packages_dev=gcc" ARGS="$ARGS --build-arg extra_packages_dev1=g++" ARGS="$ARGS --build-arg cc=gcc --build-arg cxx=g++" docker build $ARGS -t $ACCT/$REPO:alpine-3.16-base-built-gcc-amd64 $BASEDIR/alpine/3.16/built +docker build $ARGS -t $ACCT/$REPO:alpine-3.16-base-test-gcc-amd64 $BASEDIR/alpine/3.16/test ARGS="$ARGS_" ARGS="$ARGS --platform linux/amd64" @@ -53,6 +58,7 @@ ARGS="$ARGS --build-arg extra_packages_dev1=llvm" ARGS="$ARGS --build-arg extra_packages_dev2=llvm-dev" ARGS="$ARGS --build-arg cc=clang --build-arg cxx=clang++" docker build $ARGS -t $ACCT/$REPO:alpine-3.16-base-built-clang-amd64 $BASEDIR/alpine/3.16/built +docker build $ARGS -t $ACCT/$REPO:alpine-3.16-base-test-clang-amd64 $BASEDIR/alpine/3.16/test ARGS="$ARGS_" ARGS="$ARGS --platform linux/amd64" @@ -61,6 +67,7 @@ ARGS="$ARGS --build-arg extra_packages_dev=gcc" ARGS="$ARGS --build-arg extra_packages_dev1=g++" ARGS="$ARGS --build-arg cc=gcc --build-arg cxx=g++" docker build $ARGS -t $ACCT/$REPO:alpine-3.16-full-built-gcc-amd64 $BASEDIR/alpine/3.16/built +docker build $ARGS -t $ACCT/$REPO:alpine-3.16-full-test-gcc-amd64 $BASEDIR/alpine/3.16/test ARGS="$ARGS_" ARGS="$ARGS --platform linux/amd64" @@ -70,33 +77,6 @@ ARGS="$ARGS --build-arg extra_packages_dev1=llvm" ARGS="$ARGS --build-arg extra_packages_dev2=llvm-dev" ARGS="$ARGS --build-arg cc=clang --build-arg cxx=clang++" docker build $ARGS -t $ACCT/$REPO:alpine-3.16-full-built-clang-amd64 $BASEDIR/alpine/3.16/built - -# -# L3 - Test images -# - -ARGS="$ARGS_" -ARGS="$ARGS --platform linux/amd64" -ARGS="$ARGS --build-arg feature=base" -ARGS="$ARGS --build-arg cc=gcc --build-arg cxx=g++" -docker build $ARGS -t $ACCT/$REPO:alpine-3.16-base-test-gcc-amd64 $BASEDIR/alpine/3.16/test - -ARGS="$ARGS_" -ARGS="$ARGS --platform linux/amd64" -ARGS="$ARGS --build-arg feature=base" -ARGS="$ARGS --build-arg cc=clang --build-arg cxx=clang++" -docker build $ARGS -t $ACCT/$REPO:alpine-3.16-base-test-clang-amd64 $BASEDIR/alpine/3.16/test - -ARGS="$ARGS_" -ARGS="$ARGS --platform linux/amd64" -ARGS="$ARGS --build-arg feature=full" -ARGS="$ARGS --build-arg cc=gcc --build-arg cxx=g++" -docker build $ARGS -t $ACCT/$REPO:alpine-3.16-full-test-gcc-amd64 $BASEDIR/alpine/3.16/test - -ARGS="$ARGS_" -ARGS="$ARGS --platform linux/amd64" -ARGS="$ARGS --build-arg feature=full" -ARGS="$ARGS --build-arg cc=clang --build-arg cxx=clang++" docker build $ARGS -t $ACCT/$REPO:alpine-3.16-full-test-clang-amd64 $BASEDIR/alpine/3.16/test #