-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.cli
63 lines (45 loc) · 1.7 KB
/
Dockerfile.cli
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
# syntax=docker/dockerfile:1
# Control plane CLI tools for EJFAT
#
# This is a two-stage build, with compile and deploy stages
#
# Stage 'base': image with dependencies
#
FROM ubuntu:22.04 AS base
ENV DISTRO=ubuntu22
ENV HOME=/home/ubuntu
ENV LD_LIBRARY_PATH=/usr/local/lib
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
ENV PATH=/usr/local/bin:$PATH
ENV E2SARINSTALL=/e2sar-install
ENV E2SAR_DEPS_DEB=E2SAR-main-0.1.2-ubuntu-22.04/e2sar-deps_0.1.2_amd64.deb
ENV E2SAR_DEPS_DEB_URL=https://github.com/JeffersonLab/E2SAR/releases/download/${E2SAR_DEPS_DEB}
RUN apt-get -yq update && apt-get -yq install python3-pip build-essential autoconf cmake libtool pkg-config libglib2.0-dev ninja-build openssl libssl-dev libsystemd-dev protobuf-compiler libre2-dev gdb wget
RUN pip3 install pybind11 scapy meson
RUN wget -q -O boost_grpc.deb ${E2SAR_DEPS_DEB_URL} && dpkg -i ./boost_grpc.deb
#
# Stage 'compile'
#
FROM base AS compile
WORKDIR /src
COPY . /src/
# blow away build/ if it got copied by accident
RUN rm -rf build/
# create a build configuration
RUN PATH=$HOME/.local/bin:/usr/local/bin:$PATH BOOST_ROOT=/usr/local/ LD_LIBRARY_PATH=${LD_LIBRARY_PATH} meson setup -Dpkg_config_path=${PKG_CONFIG_PATH} --prefix ${E2SARINSTALL} build && sed -i 's/-std=c++11//g' build/build.ninja
RUN BOOST_ROOT=/usr/local meson setup -Dpkg_config_path=${PKG_CONFIG_PATH} --prefix ${E2SARINSTALL} build
# compile
RUN meson compile -C build
# install
RUN meson install -C build
#
# Stage 'deploy'
#
FROM base AS deploy
WORKDIR ${E2SARINSTALL}
ENV PATH=${E2SARINSTALL}/bin:$PATH
COPY --from=compile $E2SARINSTALL $E2SARINSTALL
COPY --from=compile $HOME $HOME
# Remove include files and gRPC stub
RUN rm -rf ${E2SARINSTALL}/include/
CMD ["lbadm"]