0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-31 19:08:59 +01:00

docker/alpine: Use build args for urls/versions.

This commit is contained in:
Jason Volk 2022-08-08 10:42:37 -07:00
parent e7f3bdafa6
commit 3c59438fae
2 changed files with 19 additions and 36 deletions

View file

@ -9,15 +9,18 @@ ARG cxx
ARG extra_packages_dev ARG extra_packages_dev
ARG extra_packages_dev1 ARG extra_packages_dev1
ARG extra_packages_dev2 ARG extra_packages_dev2
ARG rocksdb_version 7.4.3
ENV rocks_version 7.4.3 ARG rocksdb_url
ENV rocks_url https://codeload.github.com/facebook/rocksdb/tar.gz/refs/tags/v${rocks_version} ARG ctor_url https://github.com/matrix-construct/construct
ENV ctor_url https://github.com/matrix-construct/construct
ENV CC ${cc} ENV CC ${cc}
ENV CXX ${cxx} ENV CXX ${cxx}
ENV CONFIG_SHELL bash 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="\ ENV packages_dev="\
${packages_dev} \ ${packages_dev} \
autoconf \ autoconf \
@ -38,10 +41,10 @@ ${extra_packages_dev2} \
WORKDIR /usr/src WORKDIR /usr/src
RUN true \ RUN true \
&& apk add --no-cache ${packages_dev} \ && apk add --no-cache ${packages_dev} \
&& curl -sL ${rocks_url} -o rocksdb-${rocks_version}.tar.gz \ && curl -sL ${rocksdb_url} -o rocksdb-${rocksdb_version}.tar.gz \
&& tar xfz rocksdb-${rocks_version}.tar.gz \ && tar xfz rocksdb-${rocksdb_version}.tar.gz \
&& rm -v rocksdb-${rocks_version}.tar.gz \ && rm -v rocksdb-${rocksdb_version}.tar.gz \
&& mv -v rocksdb-${rocks_version} rocksdb \ && mv -v rocksdb-${rocksdb_version} rocksdb \
&& git clone ${ctor_url} construct \ && git clone ${ctor_url} construct \
&& rmdir -v construct/deps/rocksdb \ && rmdir -v construct/deps/rocksdb \
&& ln -sv /usr/src/rocksdb construct/deps/rocksdb \ && ln -sv /usr/src/rocksdb construct/deps/rocksdb \

View file

@ -3,11 +3,15 @@
BASEDIR=$(dirname "$0") BASEDIR=$(dirname "$0")
ACCT=jevolk ACCT=jevolk
REPO=construct REPO=construct
ctor_url="https://github.com/matrix-construct/construct"
rocksdb_version=7.4.3
ARGS_="" ARGS_=""
ARGS_="$ARGS_ --compress=true" ARGS_="$ARGS_ --compress=true"
ARGS_="$ARGS_ --build-arg acct=$ACCT" ARGS_="$ARGS_ --build-arg acct=$ACCT"
ARGS_="$ARGS_ --build-arg repo=$REPO" 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 DOCKER_BUILDKIT=1
#export BUILDKIT_PROGRESS=plain #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 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_" 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 extra_packages_dev1=g++"
ARGS="$ARGS --build-arg cc=gcc --build-arg cxx=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-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_"
ARGS="$ARGS --platform linux/amd64" 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 extra_packages_dev2=llvm-dev"
ARGS="$ARGS --build-arg cc=clang --build-arg cxx=clang++" 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-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_"
ARGS="$ARGS --platform linux/amd64" 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 extra_packages_dev1=g++"
ARGS="$ARGS --build-arg cc=gcc --build-arg cxx=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-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_"
ARGS="$ARGS --platform linux/amd64" 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 extra_packages_dev2=llvm-dev"
ARGS="$ARGS --build-arg cc=clang --build-arg cxx=clang++" 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 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 docker build $ARGS -t $ACCT/$REPO:alpine-3.16-full-test-clang-amd64 $BASEDIR/alpine/3.16/test
# #