-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
54 lines (43 loc) · 1.85 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
FROM ubuntu:23.10 as build
# Install dependencies.
RUN set -ex; \
apt-get update; \
apt-get install -y cmake g++ gcc curl libssl-dev;
# Install/build MongoDB C driver.
WORKDIR /app/repos
RUN curl -OL https://github.com/mongodb/mongo-c-driver/releases/download/1.24.3/mongo-c-driver-1.24.3.tar.gz
RUN tar -xzf mongo-c-driver-1.24.3.tar.gz
WORKDIR /app/repos/mongo-c-driver-1.24.3/cmake-build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_TESTS=OFF
RUN cmake --build . --target install
# Install/build MongoDB CXX driver.
WORKDIR /app/repos
RUN curl -OL https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.8.0/mongo-cxx-driver-r3.8.0.tar.gz
RUN tar -xzf mongo-cxx-driver-r3.8.0.tar.gz
WORKDIR /app/repos/mongo-cxx-driver-r3.8.0/build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_CXX_STANDARD=20 -DENABLE_TESTS=OFF
RUN cmake --build . --target install
# Install/build Prometheus metrics.
WORKDIR /app/repos
RUN curl -OL https://github.com/jupp0r/prometheus-cpp/releases/download/v1.1.0/prometheus-cpp-with-submodules.tar.gz
RUN tar -xzf prometheus-cpp-with-submodules.tar.gz
WORKDIR /app/repos/prometheus-cpp-with-submodules/_build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_CXX_STANDARD=20 -DBUILD_SHARED_LIBS=ON -DENABLE_PUSH=OFF -DENABLE_COMPRESSION=OFF
RUN cmake --build . --target install
# Copy source files.
COPY . /app
# Build.
WORKDIR /app/build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release && make
FROM ubuntu:23.10
# Install dependencies.
RUN set -ex; \
apt-get update; \
apt-get install -y libssl3;
# Copy the build artificat.
COPY --from=build /app/build/bin/ardos /app/ardos
COPY --from=build /app/build/bin/libuv.s* /usr/local/lib/
COPY --from=build /usr/local/lib/lib* /usr/local/lib/
RUN ldconfig
# Run.
ENTRYPOINT ["./app/ardos"]