|
| 1 | +# syntax = docker/dockerfile:1.2-labs |
1 | 2 | # Dockerfile.bionic
|
2 | 3 | #
|
3 | 4 | # See Dockerfile.focal for documentation of each of the lines.
|
4 |
| -ARG BUILD_FROM=ubuntu:18.04 |
5 |
| -ARG DEPLOY_FROM=${BUILD_FROM} |
6 |
| - |
7 |
| -FROM ${BUILD_FROM} AS build |
| 5 | +FROM ubuntu:18.04 |
8 | 6 |
|
9 | 7 | # Install System Packages
|
10 | 8 | COPY Makefile.setup /cloe/Makefile.setup
|
11 |
| -RUN apt-get update && \ |
12 |
| - apt-get install -y make locales && \ |
| 9 | +RUN --mount=type=cache,id=bionic-cache,target=/var/cache/apt \ |
| 10 | + --mount=type=cache,id=bionic-lib,target=/var/lib/apt \ |
| 11 | + apt-get update && \ |
| 12 | + apt-get install -y make ccache locales libbsd0 && \ |
13 | 13 | make -f /cloe/Makefile.setup \
|
14 | 14 | WITHOUT_DEV_DEPS=yes \
|
15 | 15 | DEBIAN_FRONTEND=noninteractive \
|
16 | 16 | APT_ARGS="--no-install-recommends -y" \
|
17 | 17 | install-system-deps \
|
18 | 18 | && \
|
19 |
| - locale-gen en_US.UTF-8 && \ |
| 19 | + locale-gen && \ |
20 | 20 | rm -rf /var/lib/apt/lists/*
|
21 | 21 |
|
| 22 | +ENV LANG=C.UTF-8 |
| 23 | +ENV LC_ALL=C.UTF-8 |
| 24 | +ENV CCACHE_DIR=/ccache |
| 25 | +ENV PATH=/usr/lib/ccache:$PATH |
| 26 | + |
22 | 27 | RUN pip3 install --upgrade pip && \
|
23 | 28 | make -f /cloe/Makefile.setup \
|
24 | 29 | PIP_INSTALL_ARGS="" \
|
25 | 30 | install-python-deps
|
26 | 31 |
|
27 | 32 | # Install and Setup Conan
|
28 |
| -ARG CONAN_REMOTE=https://conan.bintray.com |
29 |
| -ARG CONAN_REMOTE_VERIFY_SSL=true |
30 |
| -ARG CONAN_LOGIN_USERNAME |
31 |
| -ARG CONAN_PASSWORD |
| 33 | +ARG BUILD_TYPE=RelWithDebInfo |
32 | 34 | RUN conan profile new --detect default && \
|
33 |
| - conan profile update settings.compiler.libcxx=libstdc++11 default && \ |
34 |
| - conan config set general.request_timeout=360 && \ |
35 |
| - conan remote clean && \ |
36 |
| - conan remote add default ${CONAN_REMOTE} ${CONAN_REMOTE_VERIFY_SSL} |
| 35 | + conan profile update settings.build_type=${BUILD_TYPE} default && \ |
| 36 | + conan profile update settings.compiler.libcxx=libstdc++11 default |
| 37 | + |
| 38 | +ENV CONAN_NON_INTERACTIVE=yes |
37 | 39 |
|
38 | 40 | # Build and Install Cloe
|
39 | 41 | WORKDIR /cloe
|
40 |
| -COPY . /cloe |
41 | 42 | ARG WITH_VTD=0
|
42 |
| -ARG PACKAGE_TARGET=package-select |
43 |
| -RUN export CONAN_NON_INTERACTIVE=yes && \ |
44 |
| - if [ ${CONAN_LOGIN_USERNAME} != "" ]; then \ |
45 |
| - CONAN_LOGIN_USERNAME="${CONAN_LOGIN_USERNAME}" CONAN_PASSWORD="${CONAN_PASSWORD}" conan user --remote=default -p || exit 1; \ |
46 |
| - fi && \ |
47 |
| - make export-vendor export && \ |
| 43 | + |
| 44 | +# Download or build dependencies: |
| 45 | +COPY vendor /cloe/vendor |
| 46 | +COPY Makefile.package /cloe |
| 47 | +COPY Makefile.all /cloe |
| 48 | +ARG VENDOR_TARGET="export-vendor download-vendor" |
| 49 | +RUN --mount=type=cache,target=/ccache \ |
| 50 | + --mount=type=bind,target=/cloe/vendor/vtd/vires,from=cloe/vtd-sources:2.2.0 \ |
| 51 | + --mount=type=secret,target=/root/setup.sh,id=setup,mode=0400 \ |
| 52 | + if [ -r /root/setup.sh ]; then . /root/setup.sh; fi && \ |
| 53 | + make -f Makefile.all WITH_VTD=${WITH_VTD} ${VENDOR_TARGET} && \ |
| 54 | + # Clean up: |
| 55 | + find /root/.conan/data -name dl -type d -maxdepth 5 -exec rm -r {} + && \ |
| 56 | + conan remove \* -s -b -f && \ |
| 57 | + conan user --clean |
| 58 | + |
| 59 | +# Build Cloe. |
| 60 | +COPY . /cloe |
| 61 | +ARG PACKAGE_TARGET=package-auto |
| 62 | +RUN --mount=type=cache,target=/ccache \ |
| 63 | + --mount=type=secret,target=/root/setup.sh,id=setup,mode=0400 \ |
| 64 | + if [ -r /root/setup.sh ]; then . /root/setup.sh; fi && \ |
48 | 65 | make WITH_VTD=${WITH_VTD} ${PACKAGE_TARGET} && \
|
49 |
| - conan remove \* -b -f && \ |
| 66 | + # Clean up: |
| 67 | + find /root/.conan/data -name dl -type d -maxdepth 5 -exec rm -r {} + && \ |
| 68 | + conan remove \* -s -b -f && \ |
50 | 69 | conan user --clean
|
51 | 70 |
|
52 |
| -ARG VI_LIC_SERVER |
53 |
| -RUN export LC_ALL=C.UTF-8 LANG=C.UTF-8 && \ |
54 |
| - export VI_LIC_SERVER="${VI_LIC_SERVER}" && \ |
55 |
| - make WITH_VTD=${WITH_VTD} smoketest && \ |
56 |
| - make WITH_VTD=${WITH_VTD} INSTALL_DIR="/deploy" deploy |
57 |
| - |
58 |
| -# Create Deploy Image |
59 |
| -FROM ${DEPLOY_FROM} |
60 |
| -COPY --from=build /deploy /usr/local/ |
61 |
| -ENV LD_LIBRARY_PATH=/usr/local/lib |
62 |
| -ENTRYPOINT [ "cloe-engine" ] |
| 71 | +# Run smoketests. |
| 72 | +RUN --mount=type=secret,target=/root/setup.sh,id=setup,mode=0400 \ |
| 73 | + --network=default \ |
| 74 | + if [ -r /root/setup.sh ]; then . /root/setup.sh; fi && \ |
| 75 | + make WITH_VTD=${WITH_VTD} smoketest |
0 commit comments