base: Split into Dockerfile.in and common.docker

So common.docker can be re-used in other images that are not built FROM base.
This commit is contained in:
Matt McCormick 2016-09-20 00:35:37 -04:00
parent 59ba030070
commit 755f45b412
5 changed files with 84 additions and 78 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
bin
dockcross
*/test/
Dockerfile

View File

@ -1,78 +0,0 @@
FROM debian:jessie
MAINTAINER Matt McCormick "matt.mccormick@kitware.com"
# Insert this line before "RUN apt-get update" to dynamically
# replace httpredir.debian.org with a single working domain
# in attempt to "prevent" the "Error reading from server" error.
RUN apt-get update && apt-get install -y curl && \
sed -i "s/httpredir.debian.org/`curl -s -D - http://httpredir.debian.org/demo/debian/ | awk '/^Link:/ { print $2 }' | sed -e 's@<http://\(.*\)/debian/>;@\1@g'`/" /etc/apt/sources.list
RUN apt-get update && apt-get -y install \
automake \
autogen \
bash \
build-essential \
bzip2 \
ca-certificates \
curl \
file \
git \
gzip \
libcurl4-openssl-dev \
libssl-dev \
make \
ncurses-dev \
pkg-config \
libtool \
python \
rsync \
sed \
bison \
flex \
tar \
vim \
wget \
runit \
xz-utils && \
apt-get -y clean
WORKDIR /usr/share
RUN git clone https://github.com/nojhan/liquidprompt.git && \
cd liquidprompt && \
git checkout v_1.11
COPY imagefiles/.bashrc /root/
# Build and install CMake from source.
WORKDIR /usr/src
RUN git clone git://cmake.org/cmake.git CMake && \
cd CMake && \
git checkout v3.6.1 && \
cd .. && mkdir CMake-build && cd CMake-build && \
/usr/src/CMake/bootstrap \
--parallel=$(nproc) \
--prefix=/usr && \
make -j$(nproc) && \
./bin/cmake -DCMAKE_USE_SYSTEM_CURL:BOOL=ON \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_USE_OPENSSL:BOOL=ON . && \
make install && \
cd .. && \
rm -rf CMake*
# Wrappers that point to CMAKE_TOOLCHAIN_FILE
# Build and install Ninja from source
RUN git clone https://github.com/martine/ninja.git && \
cd ninja && \
git checkout v1.7.1 && \
python ./configure.py --bootstrap && \
./ninja && \
cp ./ninja /usr/bin/ && \
cd .. && rm -rf ninja
COPY imagefiles/cmake.sh /usr/local/bin/cmake
COPY imagefiles/ccmake.sh /usr/local/bin/ccmake
RUN echo "root:root" | chpasswd
WORKDIR /work
ENTRYPOINT ["/dockcross/entrypoint.sh"]
COPY imagefiles/entrypoint.sh imagefiles/dockcross /dockcross/

36
Dockerfile.in Normal file
View File

@ -0,0 +1,36 @@
FROM debian:jessie
MAINTAINER Matt McCormick "matt.mccormick@kitware.com"
RUN apt-get update && apt-get install -y curl && \\
sed -i "s/httpredir.debian.org/`curl -s -D - http://httpredir.debian.org/demo/debian/ | awk '/^Link:/ { print $2 }' | sed -e 's@<http://\(.*\)/debian/>;@\1@g'`/" /etc/apt/sources.list
RUN apt-get update && apt-get -y install \\
automake \\
autogen \\
bash \\
build-essential \\
bzip2 \\
ca-certificates \\
curl \\
file \\
git \\
gzip \\
libcurl4-openssl-dev \\
libssl-dev \\
make \\
ncurses-dev \\
pkg-config \\
libtool \\
python \\
rsync \\
sed \\
bison \\
flex \\
tar \\
vim \\
wget \\
runit \\
xz-utils && \\
apt-get -y clean
#include "common.docker"

View File

@ -71,6 +71,13 @@ linux-ppc64le.test: linux-ppc64le test/run.py
$(DOCKER) run --rm dockcross/linux-ppc64le > $(BIN)/dockcross-linux-ppc64le && chmod +x $(BIN)/dockcross-linux-ppc64le
$(BIN)/dockcross-linux-ppc64le python test/run.py --languages C
manylinux-x64: base manylinux-x64/Dockerfile
$(DOCKER) build -t $(ORG)/manylinux-x64 manylinux-x64
manylinux-x64.test: manylinux-x64 test/run.py
$(DOCKER) run --rm dockcross/manylinux-x64 > $(BIN)/dockcross-manylinux-x64 && chmod +x $(BIN)/dockcross-manylinux-x64
$(BIN)/dockcross-manylinux-x64 python test/run.py
windows-x86: base windows-x86/Dockerfile windows-x86/settings.mk
$(DOCKER) build -t $(ORG)/windows-x86 windows-x86
@ -85,6 +92,9 @@ windows-x64.test: windows-x64 test/run.py
$(DOCKER) run --rm dockcross/windows-x64 > $(BIN)/dockcross-windows-x64 && chmod +x $(BIN)/dockcross-windows-x64
$(BIN)/dockcross-windows-x64 python test/run.py --exe-suffix ".exe"
Dockerfile: Dockerfile.in common.docker
cpp -o Dockerfile Dockerfile.in
base: Dockerfile
$(DOCKER) build -t $(ORG)/base .

37
common.docker Normal file
View File

@ -0,0 +1,37 @@
WORKDIR /usr/share
RUN git clone "https://github.com/nojhan/liquidprompt.git" && \\
cd liquidprompt && \\
git checkout v_1.11
COPY imagefiles/.bashrc /root/
WORKDIR /usr/src
RUN git clone "https://cmake.org/cmake.git" CMake && \\
cd CMake && \\
git checkout v3.6.1 && \\
cd .. && mkdir CMake-build && cd CMake-build && \\
/usr/src/CMake/bootstrap \\
--parallel=$(nproc) \\
--prefix=/usr && \\
make -j$(nproc) && \\
./bin/cmake -DCMAKE_USE_SYSTEM_CURL:BOOL=ON \\
-DCMAKE_BUILD_TYPE:STRING=Release \\
-DCMAKE_USE_OPENSSL:BOOL=ON . && \\
make install && \\
cd .. && \\
rm -rf CMake*
RUN git clone "https://github.com/martine/ninja.git" && \\
cd ninja && \\
git checkout v1.7.1 && \\
python ./configure.py --bootstrap && \\
./ninja && \\
cp ./ninja /usr/bin/ && \\
cd .. && rm -rf ninja
COPY imagefiles/cmake.sh /usr/local/bin/cmake
COPY imagefiles/ccmake.sh /usr/local/bin/ccmake
RUN echo "root:root" | chpasswd
WORKDIR /work
ENTRYPOINT ["/dockcross/entrypoint.sh"]
COPY imagefiles/entrypoint.sh imagefiles/dockcross /dockcross/