-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
74 lines (51 loc) · 1.75 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
FROM ubuntu:22.10 as base
RUN apt-get update && apt-get install -y cmake g++ libasan6 libcurl4-openssl-dev git libssl-dev pkg-config uuid-dev
RUN apt-get update && apt-get install -y build-essential autoconf libtool pkg-config curl unzip zip
WORKDIR /
# install protobuf first, then grpc,
ENV PROTO_HOME="/proto_home"
RUN mkdir -p $PROTO_HOME
WORKDIR $HOME
ENV MY_INSTALL_DIR="${HOME}/.local"
RUN mkdir -p $MY_INSTALL_DIR
WORKDIR $MY_INSTALL_DIR
ENV OLD_PATH "$PATH"
ENV NEW_PATH "$MY_INSTALL_DIR/bin:$OLD_PATH"
RUN echo "export PATH=$MY_INSTALL_DIR/bin:$OLD_PATH" >> ~/.bashrc
RUN echo "export PATH=$/bin:$MY_INSTALL_DIR/bin:$OLD_PATH" >> /etc/environment
RUN echo $NEW_PATH
RUN git clone --recurse-submodules -b v1.50.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc
WORKDIR $MY_INSTALL_DIR/grpc
#RUN dpkg-reconfigure dash --no-reload
RUN apt-get update && apt-get install -y bash
SHELL ["/bin/bash", "-c"]
RUN ls -l
RUN mkdir -p cmake/build \
&& pushd cmake/build \
&& cmake -DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DCMAKE_INSTALL_PREFIX=$MY_INSTALL_DIR \
../.. \
&& make -j 4 \
&& make install \
&& popd
WORKDIR /cbdp
# Copy code
COPY . .
RUN rm -rf cmake-build-debug
RUN apt-get install -y sqlite3 libsqlite3-dev
# Build
RUN mkdir -p cmake-build-debug
RUN cd cmake-build-debug && cmake -DCMAKE_PREFIX_PATH=$MY_INSTALL_DIR ..
RUN cd cmake-build-debug && make
FROM base as loadBalancer
COPY --from=base /cbdp/cmake-build-debug/src/loadBalancer .
WORKDIR /data
CMD exec /cbdp/loadBalancer
FROM base as raft
COPY --from=base /cbdp/cmake-build-debug/src/raft .
WORKDIR /data
CMD exec /cbdp/raft $RAFT_NODE_NUMBER
FROM base as client
WORKDIR cbdp
COPY --from=base /cbdp/cmake-build-debug/src/client .