0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 07:23:53 +01:00

docker: Deduplicate Alpine -built into argumented stages. [ci skip]

This commit is contained in:
Jason Volk 2022-07-26 18:52:16 -07:00
parent 26810294e1
commit b2682d4e63
8 changed files with 214 additions and 138 deletions

View file

@ -10,7 +10,7 @@
| | |
|:---:|:---|
| [![](https://img.shields.io/docker/image-size/jevolk/construct/alpine-3.16-base-built.svg?label=alpine3.16-base&logo=Docker&style=flat-square&color=5965AF&logoWidth=38)](https://registry.hub.docker.com/r/jevolk/construct/tags) | `docker pull jevolk/construct:alpine-3.16-base-built` |
| [![](https://img.shields.io/docker/image-size/jevolk/construct/alpine-3.16-base-built.svg?label=alpine3.16-mini&logo=Docker&style=flat-square&color=5965AF&logoWidth=38)](https://registry.hub.docker.com/r/jevolk/construct/tags) | `docker pull jevolk/construct:alpine-3.16-base-built` |
| [![](https://img.shields.io/docker/image-size/jevolk/construct/alpine-3.16-full-built.svg?label=alpine-3.16-full&logo=Docker&style=flat-square&color=5965AF&logoWidth=32)](https://registry.hub.docker.com/r/jevolk/construct/tags) | `docker pull jevolk/construct:alpine-3.16-full-built` |
| [![](https://img.shields.io/docker/image-size/jevolk/construct/ubuntu-22.04-built.svg?label=ubuntu-22.04&logo=Docker&style=flat-square&color=5965AF&logoWidth=46)](https://registry.hub.docker.com/r/jevolk/construct/tags) | `docker pull jevolk/construct:ubuntu-22.04-built` |

View file

@ -1,46 +0,0 @@
FROM jevolk/construct:alpine-3.16-base
ENV packages="\
${packages_dev} \
autoconf \
autoconf-archive \
autoconf2.13 \
automake \
bash \
binutils-gold \
curl \
gcc \
g++ \
git \
libtool \
make \
"
ENV CC gcc
ENV CXX g++
ENV CONFIG_SHELL /bin/bash
ENV rocks_version 7.4.3
RUN true \
&& apk add --no-cache ${packages} \
&& mkdir -p /usr/src \
&& cd /usr/src \
&& curl -sL https://codeload.github.com/facebook/rocksdb/tar.gz/refs/tags/v${rocks_version} -o rocksdb-${rocks_version}.tar.gz \
&& tar xfz rocksdb-${rocks_version}.tar.gz \
&& git clone https://github.com/matrix-construct/construct construct \
&& cd construct \
&& rmdir -v deps/rocksdb \
&& ln -sv /usr/src/rocksdb-${rocks_version} deps/rocksdb \
&& ./autogen.sh \
&& ./configure \
&& make -j `nproc` EXTRA_LDFLAGS="-Wl,--strip-all -Wl,--gc-sections" \
&& make install \
&& rm /usr/src/rocksdb-${rocks_version}.tar.gz \
&& rm -rf /usr/src/rocksdb-${rocks_version} \
&& rm -rf /usr/src/construct \
&& apk del --purge ${packages} \
&& true
RUN true \
&& construct -smoketest -debug -nomatrix \
&& true

View file

@ -8,6 +8,7 @@ boost-system \
boost-thread \
ca-certificates \
icu \
libatomic \
libmagic \
libsodium \
libstdc++ \
@ -30,7 +31,4 @@ zstd-dev \
RUN true \
&& apk add --no-cache ${packages} \
&& mkdir /build \
&& true
WORKDIR /build

View file

@ -0,0 +1,57 @@
ARG acct
ARG repo
ARG feature
FROM ${acct}/${repo}:alpine-3.16-${feature}
ARG cc
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
ENV CC ${cc}
ENV CXX ${cxx}
ENV CONFIG_SHELL bash
ENV packages_dev="\
${packages_dev} \
autoconf \
autoconf-archive \
autoconf2.13 \
automake \
bash \
binutils-gold \
build-base \
curl \
git \
libtool \
${extra_packages_dev} \
${extra_packages_dev1} \
${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 \
&& git clone ${ctor_url} construct \
&& rmdir -v construct/deps/rocksdb \
&& ln -sv /usr/src/rocksdb construct/deps/rocksdb \
&& cd /usr/src/construct \
&& ./autogen.sh \
&& (./configure --with-profile=no || (cat config.log; exit 1)) \
&& make -j `nproc` EXTRA_LDFLAGS="-Wl,--strip-all" install \
&& rm -rf /usr/src/rocksdb \
&& rm -rf /usr/src/construct \
&& rm -rf /usr/include/ircd \
&& rm -rf /usr/share/construct \
&& apk del --purge ${packages_dev} \
&& true

View file

@ -1,46 +0,0 @@
FROM jevolk/construct:alpine-3.16-full
ENV packages="\
${packages_dev} \
autoconf \
autoconf-archive \
autoconf2.13 \
automake \
bash \
binutils-gold \
curl \
gcc \
g++ \
git \
libtool \
make \
"
ENV CC gcc
ENV CXX g++
ENV CONFIG_SHELL /bin/bash
ENV rocks_version 7.4.3
RUN true \
&& apk add --no-cache ${packages} \
&& mkdir -p /usr/src \
&& cd /usr/src \
&& curl -sL https://codeload.github.com/facebook/rocksdb/tar.gz/refs/tags/v${rocks_version} -o rocksdb-${rocks_version}.tar.gz \
&& tar xfz rocksdb-${rocks_version}.tar.gz \
&& git clone https://github.com/matrix-construct/construct construct \
&& cd construct \
&& rmdir -v deps/rocksdb \
&& ln -sv /usr/src/rocksdb-${rocks_version} deps/rocksdb \
&& ./autogen.sh \
&& ./configure \
&& make -j `nproc` EXTRA_LDFLAGS="-Wl,--strip-all -Wl,--gc-sections" \
&& make install \
&& rm /usr/src/rocksdb-${rocks_version}.tar.gz \
&& rm -rf /usr/src/rocksdb-${rocks_version} \
&& rm -rf /usr/src/construct \
&& apk del --purge ${packages} \
&& true
RUN true \
&& construct -smoketest -debug -nomatrix \
&& true

View file

@ -1,4 +1,7 @@
FROM jevolk/construct:alpine-3.16-base
ARG acct
ARG repo
FROM ${acct}/${repo}:alpine-3.16-base
ENV packages="\
freetype \

View file

@ -0,0 +1,12 @@
ARG acct
ARG repo
ARG feature
ARG cc
FROM ${acct}/${repo}:alpine-3.16-${feature}-built-${cc}
ENV ircd_mods_unload_check=false
WORKDIR /root
RUN true \
&& construct -debug -smoketest localhost \
&& true

View file

@ -1,8 +1,146 @@
#!/bin/sh
BASEDIR=$(dirname "$0")
ACCT=jevolk
REPO=construct
#ARGS="--build-arg skiprocks=1"
ARGS_=""
ARGS_="$ARGS_ --compress=true"
ARGS_="$ARGS_ --build-arg acct=$ACCT"
ARGS_="$ARGS_ --build-arg repo=$REPO"
###############################################################################
#
# Alpine 3.16
#
#
# L0 - Base featured image
#
ARGS="$ARGS_"
docker build $ARGS -t $ACCT/$REPO:alpine-3.16-base $BASEDIR/alpine/3.16/base
#
# L1 - Fully featured image
#
ARGS="$ARGS_"
docker build $ARGS -t $ACCT/$REPO:alpine-3.16-full $BASEDIR/alpine/3.16/full
#
# L3 - Built images
#
ARGS="$ARGS_"
ARGS="$ARGS --build-arg feature=base"
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 $BASEDIR/alpine/3.16/built
ARGS="$ARGS_"
ARGS="$ARGS --build-arg feature=base"
ARGS="$ARGS --build-arg extra_packages_dev=clang"
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++"
ARGS="$ARGS -t $ACCT/$REPO:alpine-3.16-base-built"
docker build $ARGS -t $ACCT/$REPO:alpine-3.16-base-built-clang $BASEDIR/alpine/3.16/built
ARGS="$ARGS_"
ARGS="$ARGS --build-arg feature=full"
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 $BASEDIR/alpine/3.16/built
ARGS="$ARGS_"
ARGS="$ARGS --build-arg feature=full"
ARGS="$ARGS --build-arg extra_packages_dev=clang"
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++"
ARGS="$ARGS -t $ACCT/$REPO:alpine-3.16-full-built"
docker build $ARGS -t $ACCT/$REPO:alpine-3.16-full-built-clang $BASEDIR/alpine/3.16/built
#
# L4 - Test images
#
ARGS="$ARGS_"
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 $BASEDIR/alpine/3.16/test
ARGS="$ARGS_"
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 $BASEDIR/alpine/3.16/test
ARGS="$ARGS_"
ARGS="$ARGS --build-arg feature=full"
ARGS="$ARGS --build-arg cc=gcc --build-arg cxx=g++"
ARGS="$ARGS -t $ACCT/$REPO:alpine-3.16-full-test"
#docker build $ARGS -t $ACCT/$REPO:alpine-3.16-full-test-gcc $BASEDIR/alpine/3.16/test
ARGS="$ARGS_"
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 $BASEDIR/alpine/3.16/test
#
# Pushed images
#
#docker push $ACCT/$REPO:alpine-3.16-base
#docker push $ACCT/$REPO:alpine-3.16-base-dev
docker push $ACCT/$REPO:alpine-3.16-base-built-gcc
docker push $ACCT/$REPO:alpine-3.16-base-built-clang
docker push $ACCT/$REPO:alpine-3.16-base-built
#docker push $ACCT/$REPO:alpine-3.16-full
#docker push $ACCT/$REPO:alpine-3.16-full-dev
docker push $ACCT/$REPO:alpine-3.16-full-built-gcc
docker push $ACCT/$REPO:alpine-3.16-full-built-clang
docker push $ACCT/$REPO:alpine-3.16-full-built
###############################################################################
#
# Ubuntu 22.04
#
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base $BASEDIR/ubuntu/22.04/base
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-full $BASEDIR/ubuntu/22.04/full
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-gcc-9 $BASEDIR/ubuntu/22.04/base-gcc-9
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-gcc-10 $BASEDIR/ubuntu/22.04/base-gcc-10
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-gcc-11 $BASEDIR/ubuntu/22.04/base-gcc-11
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-gcc-12 $BASEDIR/ubuntu/22.04/base-gcc-12
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-clang-10 $BASEDIR/ubuntu/22.04/base-clang-10
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-clang-11 $BASEDIR/ubuntu/22.04/base-clang-11
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-clang-12 $BASEDIR/ubuntu/22.04/base-clang-12
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-clang-13 $BASEDIR/ubuntu/22.04/base-clang-13
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-clang-14 $BASEDIR/ubuntu/22.04/base-clang-14
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-full-clang-14 -t $ACCT/$REPO:ubuntu-22.04-built $BASEDIR/ubuntu/22.04/full-clang-14
docker push $ACCT/$REPO:ubuntu-22.04-base
docker push $ACCT/$REPO:ubuntu-22.04-full
docker push $ACCT/$REPO:ubuntu-22.04-base-gcc-9
docker push $ACCT/$REPO:ubuntu-22.04-base-gcc-10
docker push $ACCT/$REPO:ubuntu-22.04-base-gcc-11
docker push $ACCT/$REPO:ubuntu-22.04-base-gcc-12
docker push $ACCT/$REPO:ubuntu-22.04-base-clang-10
docker push $ACCT/$REPO:ubuntu-22.04-base-clang-11
docker push $ACCT/$REPO:ubuntu-22.04-base-clang-12
docker push $ACCT/$REPO:ubuntu-22.04-base-clang-13
docker push $ACCT/$REPO:ubuntu-22.04-base-clang-14
docker push $ACCT/$REPO:ubuntu-22.04-full-clang-14
docker push $ACCT/$REPO:ubuntu-22.04-built
###############################################################################
#
# Ubuntu 20.04
#
#docker build -t $ACCT/$REPO:ubuntu-20.04 $BASEDIR/ubuntu/20.04/base
#docker build -t $ACCT/$REPO:ubuntu-20.04-gcc-8 $BASEDIR/ubuntu/20.04/gcc-8
@ -20,43 +158,3 @@ REPO=construct
#docker push $ACCT/$REPO:ubuntu-20.04-clang-10
#docker push $ACCT/$REPO:ubuntu-20.04-clang-11
#docker push $ACCT/$REPO:ubuntu-20.04-clang-12
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base $BASEDIR/ubuntu/22.04/base
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-full $BASEDIR/ubuntu/22.04/full
#docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-gcc-8 $BASEDIR/ubuntu/22.04/base-gcc-8
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-gcc-9 $BASEDIR/ubuntu/22.04/base-gcc-9
#docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-gcc-10 $BASEDIR/ubuntu/22.04/base-gcc-10
#docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-gcc-11 $BASEDIR/ubuntu/22.04/base-gcc-11
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-gcc-12 $BASEDIR/ubuntu/22.04/base-gcc-12
#docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-clang-10 $BASEDIR/ubuntu/22.04/base-clang-10
#docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-clang-11 $BASEDIR/ubuntu/22.04/base-clang-11
#docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-clang-12 $BASEDIR/ubuntu/22.04/base-clang-12
#docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-clang-13 $BASEDIR/ubuntu/22.04/base-clang-13
#docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-base-clang-14 $BASEDIR/ubuntu/22.04/base-clang-14
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-full-clang-14 $BASEDIR/ubuntu/22.04/full-clang-14
docker build $ARGS -t $ACCT/$REPO:ubuntu-22.04-built $BASEDIR/ubuntu/22.04/built
docker push $ACCT/$REPO:ubuntu-22.04-base
docker push $ACCT/$REPO:ubuntu-22.04-full
#docker push $ACCT/$REPO:ubuntu-22.04-base-gcc-8
docker push $ACCT/$REPO:ubuntu-22.04-base-gcc-9
#docker push $ACCT/$REPO:ubuntu-22.04-base-gcc-10
#docker push $ACCT/$REPO:ubuntu-22.04-base-gcc-11
docker push $ACCT/$REPO:ubuntu-22.04-base-gcc-12
#docker push $ACCT/$REPO:ubuntu-22.04-base-clang-10
#docker push $ACCT/$REPO:ubuntu-22.04-base-clang-11
#docker push $ACCT/$REPO:ubuntu-22.04-base-clang-12
#docker push $ACCT/$REPO:ubuntu-22.04-base-clang-13
#docker push $ACCT/$REPO:ubuntu-22.04-base-clang-14
docker push $ACCT/$REPO:ubuntu-22.04-full-clang-14
docker push $ACCT/$REPO:ubuntu-22.04-built
docker build $ARGS -t $ACCT/$REPO:alpine-3.16-base $BASEDIR/alpine/3.16/base
docker build $ARGS -t $ACCT/$REPO:alpine-3.16-full $BASEDIR/alpine/3.16/full
docker build $ARGS -t $ACCT/$REPO:alpine-3.16-base-built $BASEDIR/alpine/3.16/base-built
docker build $ARGS -t $ACCT/$REPO:alpine-3.16-full-built $BASEDIR/alpine/3.16/full-built
docker push $ACCT/$REPO:alpine-3.16-base
docker push $ACCT/$REPO:alpine-3.16-full
docker push $ACCT/$REPO:alpine-3.16-base-built
docker push $ACCT/$REPO:alpine-3.16-full-built