-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (48 loc) · 2.25 KB
/
Dockerfile
File metadata and controls
66 lines (48 loc) · 2.25 KB
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
FROM debian:sid-slim AS base
WORKDIR /build
# Install dependencies
RUN apt-get update && apt-get install -y \
cmake git gcc g++ ninja-build \
uuid-dev zlib1g-dev libc-ares-dev libbrotli-dev \
postgresql-all libhiredis-dev libspdlog-dev libzip-dev \
libcurl4-openssl-dev curl binutils
# Install Sentry CLI
RUN curl -sL https://sentry.io/get-cli/ | sh
# Build and install jsoncpp
RUN git clone https://github.com/open-source-parsers/jsoncpp && cd jsoncpp && git checkout 1.9.6 \
&& cmake -S . -B build -G "Ninja" -DJSONCPP_WITH_TESTS=OFF -DJSONCPP_WITH_EXAMPLE=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr \
&& cmake --build build --config Release --target install
# Build and install Drogon
RUN git clone https://github.com/drogonframework/drogon && cd drogon && git submodule update --init \
&& cmake -S . -B build -G "Ninja" -DBUILD_CTL=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_EXAMPLES=OFF -DCMAKE_CXX_STANDARD=20 \
&& cmake --build build --config Release --target install
FROM base AS build
# Prepare dir
WORKDIR /build/src
# Prepare deps
COPY $PWD/CMakeLists.txt /build/src/
COPY $PWD/modules /build/src/modules
RUN mkdir /build/src/src && touch /build/src/src/CMakeLists.txt && cmake -S . -B build -G "Ninja"
# Build app
ARG MANUAL_VERSIONING=false
ENV MANUAL_VERSIONING=${MANUAL_VERSIONING}
ARG GIT_VERSION=0.0.0
ENV GIT_VERSION=${GIT_VERSION}
ARG GIT_HASH_FULL=unknown
ENV GIT_HASH_FULL=${GIT_HASH_FULL}
ARG GIT_HASH_SHORT=unknown
ENV GIT_HASH_SHORT=${GIT_HASH_SHORT}
COPY $PWD/builtin /build/src/builtin
COPY $PWD/src /build/src/src
RUN cmake -S . -B build -G "Ninja" && cmake --build build --config RelWithDebInfo
# Extract debug info
RUN objcopy --only-keep-debug --compress-debug-sections=zlib build/bin/wiki_service build/bin/wiki_service.debug \
&& objcopy --strip-debug --strip-unneeded build/bin/wiki_service \
&& objcopy --add-gnu-debuglink=build/bin/wiki_service.debug build/bin/wiki_service
FROM debian:sid-slim AS main
WORKDIR /app
RUN apt-get update && apt-get install -y ca-certificates libspdlog-dev libc-ares-dev libfmt10 libbrotli-dev \
libhiredis-dev libpq5 libzip-dev curl git
COPY --from=build /build/src/build/bin/wiki_service /build/src/build/bin/crashpad_handler /app/
EXPOSE 8080
CMD ["./wiki_service"]