-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
83 lines (70 loc) · 2.14 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
ARG base_image=ubuntu
ARG base_tag=22.04
# Base image with environment variables set
FROM ${base_image}:${base_tag} AS base
# Set bash as the default shell
SHELL ["/bin/bash", "-c"]
ARG psyllid_tag=beta
ARG psyllid_subdir=psyllid
ARG build_type=Release
ENV P8_ROOT=/usr/local/p8
ENV PSYLLID_TAG=${psyllid_tag}
ENV PSYLLID_INSTALL_PREFIX=${P8_ROOT}/${psyllid_subdir}/${PSYLLID_TAG}
ENV PATH="${PATH}:${PSYLLID_INSTALL_PREFIX}"
# Build image with dev dependencies
FROM base AS build
RUN apt-get update &&\
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
cmake \
git \
openssl \
libfftw3-dev \
libboost-chrono-dev \
libboost-filesystem-dev \
libboost-system-dev \
libhdf5-dev \
librabbitmq-dev \
libyaml-cpp-dev \
rapidjson-dev \
&&\
apt-get clean &&\
rm -rf /var/lib/apt/lists/* &&\
/bin/true
COPY . /tmp_source
## store cmake args because we'll need to run twice (known package_builder issue)
## use `extra_cmake_args` to add or replace options at build time; CMAKE_CONFIG_ARGS_LIST are defaults
ARG extra_cmake_args=""
ENV CMAKE_CONFIG_ARGS_LIST="\
-D CMAKE_BUILD_TYPE=$build_type \
-D CMAKE_INSTALL_PREFIX:PATH=$PSYLLID_BUILD_PREFIX \
-D Psyllid_ENABLE_FPA=FALSE \
${extra_cmake_args} \
${OS_CMAKE_ARGS} \
"
RUN mkdir -p /tmp_source/build &&\
cd /tmp_source/build &&\
cmake ${CMAKE_CONFIG_ARGS_LIST} .. &&\
cmake ${CMAKE_CONFIG_ARGS_LIST} .. &&\
make install &&\
/bin/true
# Final production image
FROM base
RUN apt-get update &&\
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
libssl3 \
libfftw3-double3 \
libboost-chrono1.74.0 \
libboost-filesystem1.74.0 \
libboost-system1.74.0 \
libhdf5-cpp-103 \
librabbitmq4 \
libyaml-cpp0.7 \
rapidjson-dev \
&&\
apt-get clean &&\
rm -rf /var/lib/apt/lists/* &&\
/bin/true
# for now we must grab the extra dependency content as well as psyllid itself
COPY --from=build $PSYLLID_BUILD_PREFIX $PSYLLID_BUILD_PREFIX