use intermediate dockerfile

This commit is contained in:
dave 2021-06-09 19:53:33 -07:00
parent fd2ccbd453
commit 43dc2d76ae
8 changed files with 30 additions and 10 deletions

View File

@ -3,7 +3,7 @@ FROM ubuntu:bionic
RUN sed -i -E 's/(archive|security).ubuntu.com/192.168.1.142/' /etc/apt/sources.list && \
sed -i -E 's/^deb-src/# deb-src/' /etc/apt/sources.list && \
apt-get update && \
apt-get install -y dpkg-dev debhelper build-essential sudo wget curl
DEBIAN_FRONTEND=noninteractive apt-get install -y dpkg-dev debhelper build-essential sudo wget curl
RUN useradd builder && \
install -d /build -o builder -g builder

View File

@ -3,7 +3,7 @@ FROM ubuntu:disco
RUN sed -i -E 's/(archive|security).ubuntu.com/192.168.1.142/' /etc/apt/sources.list && \
sed -i -E 's/^deb-src/# deb-src/' /etc/apt/sources.list && \
apt-get update && \
apt-get install -y dpkg-dev debhelper build-essential sudo wget curl
DEBIAN_FRONTEND=noninteractive apt-get install -y dpkg-dev debhelper build-essential sudo wget curl
RUN useradd builder && \
install -d /build -o builder -g builder

14
Dockerfile.focal Normal file
View File

@ -0,0 +1,14 @@
FROM ubuntu:focal
RUN sed -i -E 's/(archive|security).ubuntu.com/192.168.1.142/' /etc/apt/sources.list && \
sed -i -E 's/^deb-src/# deb-src/' /etc/apt/sources.list && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y dpkg-dev debhelper build-essential sudo wget curl
RUN useradd builder && \
install -d /build -o builder -g builder
ADD scripts/bootstrap.sh /bootstrap.sh
ADD scripts/build.sh /build.sh
ENTRYPOINT ["/bootstrap.sh"]

View File

@ -3,7 +3,7 @@ FROM ubuntu:trusty
RUN sed -i -E 's/(archive|security).ubuntu.com/192.168.1.142/' /etc/apt/sources.list && \
sed -i -E 's/^deb-src/# deb-src/' /etc/apt/sources.list && \
apt-get update && \
apt-get install -y dpkg-dev debhelper build-essential sudo wget curl
DEBIAN_FRONTEND=noninteractive apt-get install -y dpkg-dev debhelper build-essential sudo wget curl
RUN useradd builder && \
install -d /build -o builder -g builder

View File

@ -3,7 +3,7 @@ FROM ubuntu:xenial
RUN sed -i -E 's/(archive|security).ubuntu.com/192.168.1.142/' /etc/apt/sources.list && \
sed -i -E 's/^deb-src/# deb-src/' /etc/apt/sources.list && \
apt-get update && \
apt-get install -y dpkg-dev debhelper build-essential sudo wget curl
DEBIAN_FRONTEND=noninteractive apt-get install -y dpkg-dev debhelper build-essential sudo wget curl
RUN useradd builder && \
install -d /build -o builder -g builder

View File

@ -4,4 +4,13 @@ VARSFILE=$1
. src/$VARSFILE
time docker run -it --rm -e "VARSFILE=$VARSFILE" -v $PWD/src:/src extbuilder-$EXTPYTHON_DIST
echo "FROM extbuilder-$EXTPYTHON_DIST" > Dockerfile.temp
echo "RUN apt-get update && \\" >> Dockerfile.temp
echo " DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\" $CPYTHON_DEPS" >> Dockerfile.temp
# build image with just the deps
docker build -t extbuilder-${EXTPYTHON_DIST}-deps -f Dockerfile.temp .
rm -f Dockerfile.temp
time docker run -it --rm -e "VARSFILE=$VARSFILE" -v $PWD/src:/src extbuilder-${EXTPYTHON_DIST}-deps

View File

@ -1,7 +1,8 @@
#!/bin/bash -ex
RELEASES="trusty xenial bionic disco"
RELEASES="trusty xenial bionic focal"
for release in $RELEASES ; do
docker pull ubuntu:${release}
docker build -t extbuilder-${release} -f Dockerfile.${release} .
done

View File

@ -5,10 +5,6 @@ ln -s /src/$VARSFILE /tmp/vars.sh
. /tmp/vars.sh
. /etc/lsb-release #for DISTRIB_CODENAME
# install deps
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" $CPYTHON_DEPS
# run the build
sudo -Hu builder /build.sh