Skip to content

Commit e893a98

Browse files
committed
tooling: Add Ubuntu 16.04 Dockerfile
- We also split Dockerfile.ubuntu to Dockerfile.focal and Dockerfile.bionic so that we maintain orthogonality. - Rename make target docker to docker-all for more clarity.
1 parent 9aca3db commit e893a98

File tree

7 files changed

+274
-30
lines changed

7 files changed

+274
-30
lines changed

Makefile

+10-10
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ include Makefile.all
4141
.PHONY: status deploy doxygen docker docker-test smoketest
4242
help::
4343
echo "Available workspace targets:"
44-
echo " status to show current workspace status"
45-
echo " deploy to deploy Cloe to INSTALL_DIR [=${INSTALL_DIR}]"
46-
echo " docker to build all Docker images"
47-
echo " docker-test to build only a single Docker image"
48-
echo " doxygen to generate Doxygen documentation"
49-
echo " smoketest to run BATS system tests"
44+
echo " status to show current workspace status"
45+
echo " deploy to deploy Cloe to INSTALL_DIR [=${INSTALL_DIR}]"
46+
echo " docker-test to build only a single Docker image"
47+
echo " docker-all to build all Docker images"
48+
echo " doxygen to generate Doxygen documentation"
49+
echo " smoketest to run BATS system tests"
5050
echo
5151

5252
status:
@@ -58,14 +58,14 @@ deploy:
5858
mkdir -p ${INSTALL_DIR}
5959
cp -r ${BUILD_DIR}/deploy/cloe-*/* ${INSTALL_DIR}/
6060

61-
docker:
62-
$(call print_header, "Building all Docker images...")
63-
${MAKE} -C dist/docker all
64-
6561
docker-test:
6662
$(call print_header, "Building ubuntu-18.04 Docker image...")
6763
${MAKE} -C dist/docker ubuntu-18.04
6864

65+
docker-all:
66+
$(call print_header, "Building all Docker images...")
67+
${MAKE} -C dist/docker all
68+
6969
doxygen:
7070
$(call print_header, "Generating Doxygen documentation...")
7171
mkdir -p ${BUILD_DIR}/doxygen

dist/docker/Dockerfile.alpine

+5-2
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,14 @@ RUN pip3 install --upgrade pip && \
4545
# Build and Install Cloe
4646
WORKDIR /cloe
4747
COPY . /cloe
48+
ARG WITH_VTD=0
49+
ARG PACKAGE_TARGET=package-select
4850
RUN make export-vendor export && \
49-
make WITH_VTD=0 package-all && \
50-
make WITH_VTD=0 INSTALL_DIR="/deploy" deploy && \
51+
make WITH_VTD=${WITH_VTD} ${PACKAGE_TARGET} && \
5152
conan remove \* -b -f
5253

54+
RUN make WITH_VTD=${WITH_VTD} INSTALL_DIR="/deploy" deploy
55+
5356
# Finalize Image
5457
FROM ${DEPLOY_FROM}
5558
COPY --from=build /deploy /usr/local/

dist/docker/Dockerfile.archlinux

+8-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ RUN pacman -Syu --noconfirm --needed make && \
1414
PACMAN_ARGS="--noconfirm --needed" \
1515
install-system-deps \
1616
&& \
17+
locale-gen en_US.UTF-8 && \
1718
pacman -Scc --noconfirm
1819

1920
RUN pip3 install --upgrade pip && \
@@ -33,13 +34,16 @@ RUN conan profile new --detect default && \
3334
# Build and Install Cloe
3435
WORKDIR /cloe
3536
COPY . /cloe
37+
ARG WITH_VTD=0
38+
ARG PACKAGE_TARGET=package-select
3639
RUN make export-vendor export && \
37-
make WITH_VTD=0 package-all && \
38-
export LC_ALL=C.UTF-8 LANG=C.UTF-8 && \
39-
make WITH_VTD=0 smoketest && \
40-
make WITH_VTD=0 INSTALL_DIR="/deploy" deploy && \
40+
make WITH_VTD=${WITH_VTD} ${PACKAGE_TARGET} && \
41+
export LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 && \
4142
conan remove \* -b -f
4243

44+
RUN make WITH_VTD=${WITH_VTD} smoketest && \
45+
make WITH_VTD=${WITH_VTD} INSTALL_DIR="/deploy" deploy
46+
4347
# Create Deploy Image
4448
FROM ${DEPLOY_FROM}
4549
COPY --from=build /deploy /usr/local/

dist/docker/Dockerfile.ubuntu renamed to dist/docker/Dockerfile.bionic

+13-8
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ FROM ${BUILD_FROM} AS build
1515
# These packages are required for building and testing Cloe.
1616
COPY Makefile.setup /cloe/Makefile.setup
1717
RUN apt-get update && \
18-
apt-get install -y make && \
18+
apt-get install -y make locales && \
1919
make -f /cloe/Makefile.setup \
2020
WITHOUT_DEV_DEPS=yes \
2121
DEBIAN_FRONTEND=noninteractive \
2222
APT_ARGS="--no-install-recommends -y" \
2323
install-system-deps \
2424
&& \
25+
locale-gen en_US.UTF-8 && \
2526
rm -rf /var/lib/apt/lists/*
2627

2728
RUN pip3 install --upgrade pip && \
@@ -49,6 +50,8 @@ RUN conan profile new --detect default && \
4950
# documentation.
5051
WORKDIR /cloe
5152
COPY . /cloe
53+
ARG WITH_VTD=0
54+
ARG PACKAGE_TARGET=package-select
5255
RUN \
5356
# Export our own Conan recipes, in case they are not available in the
5457
# CONAN_REMOTE specified above.
@@ -57,18 +60,20 @@ RUN \
5760
# dependencies we don't have in the Docker container.
5861
# You can specify more than one package here, see the Makefile for more
5962
# information on the WITH_*, PACKAGES, NOBUILD_PKGS, and BUILD_PKGS variables.
60-
make WITH_VTD=0 package-all && \
63+
make WITH_VTD=${WITH_VTD} ${PACKAGE_TARGET} && \
64+
# In the above commands, Conan downloads and creates packages into its
65+
# local cache. We don't need the build directories, since we have deployed
66+
# Cloe, so we should clean up to keep the Docker image down.
67+
conan remove \* -b -f
68+
69+
RUN \
6170
# Run smoketests.
6271
export LC_ALL=C.UTF-8 LANG=C.UTF-8 && \
63-
make WITH_VTD=0 smoketest && \
72+
make WITH_VTD=${WITH_VTD} smoketest && \
6473
# Deploy all the Cloe packages to INSTALL_DIR, which is /usr/local by
6574
# default. This will also populate BUILD_DIR, so that should be removed
6675
# afterwards to prevent this image from getting too big.
67-
make WITH_VTD=0 INSTALL_DIR="/deploy" deploy && \
68-
# In the above commands, Conan downloads and creates packages into its
69-
# local cache. We don't need the build directories, since we have deployed
70-
# Cloe, so we should clean up to keep the Docker image down.
71-
conan remove \* -b -f
76+
make WITH_VTD=${WITH_VTD} INSTALL_DIR="/deploy" deploy
7277

7378
# Create Deploy Image
7479
#

dist/docker/Dockerfile.focal

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Dockerfile.ubuntu
2+
#
3+
# This file acts partly as a Docker recipe for building Cloe on Ubuntu.
4+
# It is currently only tested with Ubuntu 18.04 and 20.04.
5+
#
6+
# If you are behind a proxy, make sure to pass in the respective HTTP_PROXY,
7+
# HTTPS_PROXY, and NO_PROXY variables.
8+
ARG BUILD_FROM=ubuntu:20.04
9+
ARG DEPLOY_FROM=${BUILD_FROM}
10+
11+
FROM ${BUILD_FROM} AS build
12+
13+
# Install System Packages
14+
#
15+
# These packages are required for building and testing Cloe.
16+
COPY Makefile.setup /cloe/Makefile.setup
17+
RUN apt-get update && \
18+
apt-get install -y make locales && \
19+
make -f /cloe/Makefile.setup \
20+
WITHOUT_DEV_DEPS=yes \
21+
DEBIAN_FRONTEND=noninteractive \
22+
APT_ARGS="--no-install-recommends -y" \
23+
install-system-deps \
24+
&& \
25+
locale-gen en_US.UTF-8 && \
26+
rm -rf /var/lib/apt/lists/*
27+
28+
RUN pip3 install --upgrade pip && \
29+
make -f /cloe/Makefile.setup \
30+
PIP_INSTALL_ARGS="" \
31+
install-python-deps
32+
33+
# Install and Setup Conan
34+
#
35+
# You may not want to use the default Conan remote (conan-center), so we use
36+
# whatever is stored in the build arguments CONAN_REMOTE. Currently, only
37+
# anonymous access is possible in this Dockerfile.
38+
ARG CONAN_REMOTE=https://conan.bintray.com
39+
ARG CONAN_REMOTE_VERIFY_SSL=true
40+
RUN conan profile new --detect default && \
41+
conan profile update settings.compiler.libcxx=libstdc++11 default && \
42+
conan config set general.request_timeout=360 && \
43+
conan remote clean && \
44+
conan remote add default ${CONAN_REMOTE} ${CONAN_REMOTE_VERIFY_SSL}
45+
46+
# Build and Install Cloe
47+
#
48+
# All common processes are made easy to apply by writing target recipes in the
49+
# Makefile at the root of the repository. This also acts as a form of
50+
# documentation.
51+
WORKDIR /cloe
52+
COPY . /cloe
53+
ARG WITH_VTD=0
54+
ARG PACKAGE_TARGET=package-select
55+
RUN \
56+
# Export our own Conan recipes, in case they are not available in the
57+
# CONAN_REMOTE specified above.
58+
make export-vendor export && \
59+
# Build all the packages, except for vtd, because that currently requires
60+
# dependencies we don't have in the Docker container.
61+
# You can specify more than one package here, see the Makefile for more
62+
# information on the WITH_*, PACKAGES, NOBUILD_PKGS, and BUILD_PKGS variables.
63+
make WITH_VTD=${WITH_VTD} ${PACKAGE_TARGET} && \
64+
# In the above commands, Conan downloads and creates packages into its
65+
# local cache. We don't need the build directories, since we have deployed
66+
# Cloe, so we should clean up to keep the Docker image down.
67+
conan remove \* -b -f
68+
69+
RUN \
70+
# Run smoketests.
71+
export LC_ALL=C.UTF-8 LANG=C.UTF-8 && \
72+
make WITH_VTD=${WITH_VTD} smoketest && \
73+
# Deploy all the Cloe packages to INSTALL_DIR, which is /usr/local by
74+
# default. This will also populate BUILD_DIR, so that should be removed
75+
# afterwards to prevent this image from getting too big.
76+
make WITH_VTD=${WITH_VTD} INSTALL_DIR="/deploy" deploy
77+
78+
# Create Deploy Image
79+
#
80+
# Unfortunately, there are still some issues with cloe-engine not finding
81+
# libcloe-runtime.so, so we need to explicitly set LD_LIBRARY_PATH.
82+
#
83+
# This image can now be used to work with stack files. You should mount in
84+
# whatever directory contains your stack files for best results, otherwise
85+
# the engine might try to read files that it doesn't have in its own filesystem.
86+
FROM ${DEPLOY_FROM}
87+
COPY --from=build /deploy /usr/local/
88+
ENV LD_LIBRARY_PATH=/usr/local/lib
89+
ENTRYPOINT [ "cloe-engine" ]

dist/docker/Dockerfile.xenial

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Dockerfile.ubuntu
2+
#
3+
# This file acts partly as a Docker recipe for building Cloe on Ubuntu.
4+
# It is currently only tested with Ubuntu 16.04.
5+
#
6+
# If you are behind a proxy, make sure to pass in the respective HTTP_PROXY,
7+
# HTTPS_PROXY, and NO_PROXY variables.
8+
ARG BUILD_FROM=ubuntu:16.04
9+
ARG DEPLOY_FROM=${BUILD_FROM}
10+
11+
FROM ${BUILD_FROM} AS build
12+
13+
# Install Newer CMake and GCC Packages
14+
RUN apt-get update && \
15+
apt-get install --no-install-recommends -y apt-transport-https ca-certificates gnupg software-properties-common wget && \
16+
# Add cmake repository:
17+
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - > /etc/apt/trusted.gpg.d/kitware.gpg && \
18+
apt-add-repository "deb https://apt.kitware.com/ubuntu/ xenial main" && \
19+
add-apt-repository "ppa:ubuntu-toolchain-r/test" && \
20+
# Install packages:
21+
apt-get update && \
22+
export DEBIAN_FRONTEND=noninteractive && \
23+
apt-get install --no-install-recommends -y gcc-8 g++-8 cmake && \
24+
rm -rf /var/lib/apt/lists/*
25+
26+
# Install Pyenv
27+
RUN apt-get update && \
28+
apt-get install --no-install-recommends -y \
29+
build-essential \
30+
curl \
31+
git \
32+
libbz2-dev \
33+
libffi-dev \
34+
liblzma-dev \
35+
libncurses5-dev \
36+
libreadline-dev \
37+
libsqlite3-dev \
38+
libssl-dev \
39+
libxml2-dev \
40+
libxmlsec1-dev \
41+
llvm \
42+
make \
43+
tk-dev \
44+
wget \
45+
xz-utils \
46+
zlib1g-dev \
47+
&& \
48+
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash && \
49+
echo 'export PATH="/root/.pyenv/bin:$PATH"' >> /etc/profile.d/pyenv.sh && \
50+
echo 'eval "$(pyenv init --path)"' >> /etc/profile.d/pyenv.sh && \
51+
echo 'eval "$(pyenv init -)"' >> /etc/profile.d/pyenv.sh && \
52+
echo 'eval "$(pyenv virtualenv-init -)"' >> /etc/profile.d/pyenv.sh && \
53+
rm -rf /var/lib/apt/lists/*
54+
55+
ARG PYTHON_VERSION=3.6.13
56+
RUN . /etc/profile.d/pyenv.sh && \
57+
pyenv install ${PYTHON_VERSION} && \
58+
pyenv global ${PYTHON_VERSION}
59+
60+
# Install System Packages
61+
#
62+
# These packages are required for building and testing Cloe.
63+
COPY Makefile.setup /cloe/Makefile.setup
64+
RUN apt-get update && \
65+
apt-get install -y make locales && \
66+
make -f /cloe/Makefile.setup \
67+
WITHOUT_DEV_DEPS=yes \
68+
DEBIAN_FRONTEND=noninteractive \
69+
APT_ARGS="--no-install-recommends -y" \
70+
install-system-deps \
71+
&& \
72+
locale-gen en_US.UTF-8 && \
73+
rm -rf /var/lib/apt/lists/*
74+
75+
RUN . /etc/profile.d/pyenv.sh && \
76+
pip install --upgrade pip && \
77+
make -f /cloe/Makefile.setup \
78+
PIP_INSTALL_ARGS="" \
79+
install-python-deps
80+
81+
# Install and Setup Conan
82+
#
83+
# You may not want to use the default Conan remote (conan-center), so we use
84+
# whatever is stored in the build arguments CONAN_REMOTE. Currently, only
85+
# anonymous access is possible in this Dockerfile.
86+
ARG CONAN_REMOTE=https://conan.bintray.com
87+
ARG CONAN_REMOTE_VERIFY_SSL=true
88+
RUN . /etc/profile.d/pyenv.sh && \
89+
conan profile new --detect default && \
90+
conan profile update settings.compiler.libcxx=libstdc++11 default && \
91+
conan config set general.request_timeout=360 && \
92+
conan remote clean && \
93+
conan remote add default ${CONAN_REMOTE} ${CONAN_REMOTE_VERIFY_SSL}
94+
95+
# Build and Install Cloe
96+
#
97+
# All common processes are made easy to apply by writing target recipes in the
98+
# Makefile at the root of the repository. This also acts as a form of
99+
# documentation.
100+
WORKDIR /cloe
101+
COPY . /cloe
102+
ARG WITH_VTD=0
103+
ARG PACKAGE_TARGET=package-select
104+
RUN . /etc/profile.d/pyenv.sh && \
105+
# Export our own Conan recipes, in case they are not available in the
106+
# CONAN_REMOTE specified above.
107+
make export-vendor export && \
108+
# Build all the packages, except for vtd, because that currently requires
109+
# dependencies we don't have in the Docker container.
110+
# You can specify more than one package here, see the Makefile for more
111+
# information on the WITH_*, PACKAGES, NOBUILD_PKGS, and BUILD_PKGS variables.
112+
make WITH_VTD=${WITH_VTD} ${PACKAGE_TARGET} && \
113+
# In the above commands, Conan downloads and creates packages into its
114+
# local cache. We don't need the build directories, since we have deployed
115+
# Cloe, so we should clean up to keep the Docker image down.
116+
conan remove \* -b -f
117+
118+
RUN . /etc/profile.d/pyenv.sh && \
119+
# Run smoketests.
120+
export LC_ALL=C.UTF-8 LANG=C.UTF-8 && \
121+
make WITH_VTD=${WITH_VTD} smoketest && \
122+
# Deploy all the Cloe packages to INSTALL_DIR, which is /usr/local by
123+
# default. This will also populate BUILD_DIR, so that should be removed
124+
# afterwards to prevent this image from getting too big.
125+
make WITH_VTD=${WITH_VTD} INSTALL_DIR="/deploy" deploy
126+
127+
# Create Deploy Image
128+
#
129+
# Unfortunately, there are still some issues with cloe-engine not finding
130+
# libcloe-runtime.so, so we need to explicitly set LD_LIBRARY_PATH.
131+
#
132+
# This image can now be used to work with stack files. You should mount in
133+
# whatever directory contains your stack files for best results, otherwise
134+
# the engine might try to read files that it doesn't have in its own filesystem.
135+
FROM ${DEPLOY_FROM}
136+
COPY --from=build /deploy /usr/local/
137+
ENV LD_LIBRARY_PATH=/usr/local/lib
138+
ENTRYPOINT [ "cloe-engine" ]

0 commit comments

Comments
 (0)