diff options
| author | soler_j <soler_j@etna-alternance.net> | 2025-04-29 01:24:46 +0200 |
|---|---|---|
| committer | soler_j <soler_j@etna-alternance.net> | 2025-04-29 01:24:46 +0200 |
| commit | 0c53f3e452830b300c598c9370946ae54f443a78 (patch) | |
| tree | 1d05f2de4b2f9b7ae6a0cae18e21ba4f5cab517e | |
| parent | fe6e33563d7c836f3cf33e116525812b86f14962 (diff) | |
| parent | 977ae7500a537d6dc5bd3514efdd6015ee058c2c (diff) | |
:qMerge branch 'main' of github.com:ketsuna-org/bot-creator-api
| -rw-r--r-- | Dockerfile | 52 | ||||
| -rw-r--r-- | bot/CMakeLists.txt | 4 |
2 files changed, 35 insertions, 21 deletions
@@ -5,49 +5,59 @@ COPY app/ . RUN CGO_ENABLED=0 go build -o /api/app ./cmd/main.go # Étape de compilation pour le programme C++ avec DPP -FROM alpine:3.21 AS cpp-builder -RUN apk add --no-cache build-base cmake git openssl-dev zlib-dev opus-dev clang - -# Clonage de DPP +FROM ubuntu:24.04 AS cpp-builder + +# Install build dependencies +RUN apt-get update && apt-get install -y \ + build-essential \ + cmake \ + git \ + libssl-dev \ + zlib1g-dev \ + libopus-dev \ + clang \ + pkg-config + +# Clone DPP RUN git clone https://github.com/brainboxdotcc/DPP.git /dpp && \ cd /dpp && \ git checkout c6bcab5b4632fe35e32e63e3bc813e9e2cd2893e && \ git submodule update --init --recursive -# Construction de DPP +# Build DPP (shared) RUN mkdir -p /dpp/build && \ cd /dpp/build && \ - cmake .. -DDPP_BUILD_TEST=OFF && \ + cmake .. \ + -DDPP_BUILD_TEST=OFF && \ make -j$(nproc) && \ - make install && \ - cp -r /dpp/include/dpp /usr/include/ && \ - cp /usr/local/lib/libdpp* /usr/lib/ + make install -# Construction du bot utilisateur +# Build user bot WORKDIR /src COPY bot/ . -# Construction en pointant vers DPP installé localement RUN mkdir build && cd build && \ - cmake .. && \ + cmake .. \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_PREFIX_PATH=/usr/local && \ make -j$(nproc) # Étape finale d'exécution -FROM alpine:3.21 +FROM ubuntu:24.04 WORKDIR /app +# Install runtime deps +RUN apt-get update && apt-get install -y libssl3 zlib1g libopus0 && apt-get clean + # Copie des binaires COPY --from=go-builder /api ./api -COPY --from=cpp-builder /usr/local/lib/libdpp* /usr/lib/ COPY --from=cpp-builder /src/build/discord-bot ./bot/build/discord-bot +COPY --from=cpp-builder /usr/local/lib/ /usr/local/lib/ -# Installation des dépendances runtime -RUN apk add --no-cache \ - libstdc++ \ - libssl3 \ - zlib \ - opus - +# Make sure executables are runnable RUN chmod +x ./api/app ./bot/build/discord-bot +# Pour être sûr que libdpp.so soit trouvée +ENV LD_LIBRARY_PATH=/usr/local/lib + ENTRYPOINT ["./api/app"] diff --git a/bot/CMakeLists.txt b/bot/CMakeLists.txt index 2dc8fb1..2ac0346 100644 --- a/bot/CMakeLists.txt +++ b/bot/CMakeLists.txt @@ -25,6 +25,10 @@ add_executable(${PROJECT_NAME} # Link libraries with proper dependencies target_link_libraries(${PROJECT_NAME} PRIVATE dpp + OpenSSL::SSL + OpenSSL::Crypto + z + opus ) # Include directories |
