diff options
| author | soler_j <soler_j@etna-alternance.net> | 2025-04-27 19:29:04 +0200 |
|---|---|---|
| committer | soler_j <soler_j@etna-alternance.net> | 2025-04-27 19:29:04 +0200 |
| commit | d497fec2d9d32359428f63595989065c1c9cf5a8 (patch) | |
| tree | c3251b18ad7ec78de42efea1aed0b3def8acb571 | |
| parent | 25dd6dacd640bd35bead58173eeac6b7c62e1446 (diff) | |
Ajout du fichier DockerFile pour la compilation des programmes Go et C++, mise à jour de la configuration de l'environnement de développement, et ajout du fichier go.mod pour la gestion des dépendances.
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | .vscode/settings.json | 2 | ||||
| -rw-r--r-- | DockerFile | 60 | ||||
| -rw-r--r-- | app/go.mod | 5 | ||||
| -rw-r--r-- | devenv.lock | 4 | ||||
| -rw-r--r-- | devenv.nix | 1 |
6 files changed, 68 insertions, 5 deletions
@@ -17,7 +17,6 @@ *.dll # Fortran module files -*.mod *.smod # Compiled Static libraries diff --git a/.vscode/settings.json b/.vscode/settings.json index 0954d11..2a84036 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "cmake.sourceDirectory": "/Users/jeremy/Documents/bot-creator-api/bot", + "cmake.sourceDirectory": "/home/exa/perso/bot-creator-api/bot", "files.associations": { "map": "cpp", "__bit_reference": "cpp", diff --git a/DockerFile b/DockerFile new file mode 100644 index 0000000..13ef32a --- /dev/null +++ b/DockerFile @@ -0,0 +1,60 @@ +# Étape de compilation pour le programme Go +FROM golang:1.23-alpine AS go-builder +WORKDIR /app +COPY app/ . +RUN CGO_ENABLED=0 go build -o /api main.go + +# Étape de compilation pour le programme C++ avec DPP +FROM ubuntu:24.04 AS cpp-builder + +# Installation des dépendances système +RUN apt-get update && \ + apt-get install -y \ + git \ + gcc \ + g++ \ + cmake \ + clang-tools \ + libssl-dev \ + zlib1g-dev \ + libopus-dev \ + pkg-config + +# Clonage de DPP avec le commit spécifique +RUN git clone https://github.com/brainboxdotcc/DPP.git /dpp && \ + cd /dpp && \ + git checkout c6bcab5b4632fe35e32e63e3bc813e9e2cd2893e && \ + git submodule update --init --recursive + +# Construction de DPP +RUN mkdir -p /dpp/build && \ + cd /dpp/build && \ + cmake .. -DDPP_BUILD_TEST=OFF && \ + make -j$(nproc) && \ + make install + +# Construction du bot utilisateur +WORKDIR /bot +COPY bot/ . +RUN mkdir -p build && \ + cd build && \ + cmake .. -DCMAKE_PREFIX_PATH=/dpp/build && \ + make -j$(nproc) + +# Étape finale d'exécution +FROM alpine:3.21 +WORKDIR /app + +# Copie des binaires +COPY --from=go-builder /api . +COPY --from=cpp-builder /bot/build/bot . + +# Installation des dépendances runtime +RUN apk add --no-cache \ + libstdc++ \ + libssl3 \ + zlib \ + opus + +# Configuration des points d'entrée +ENTRYPOINT ["/app/api"] diff --git a/app/go.mod b/app/go.mod new file mode 100644 index 0000000..0fdbadd --- /dev/null +++ b/app/go.mod @@ -0,0 +1,5 @@ +module github.com/ketsuna-org/bot-creator-api + +go 1.23.3 + +require github.com/arangodb/go-driver/v2 v2.1.3 // indirect diff --git a/devenv.lock b/devenv.lock index 2388897..f92d9c0 100644 --- a/devenv.lock +++ b/devenv.lock @@ -3,10 +3,10 @@ "devenv": { "locked": { "dir": "src/modules", - "lastModified": 1745604263, + "lastModified": 1745750098, "owner": "cachix", "repo": "devenv", - "rev": "36807c727e743e7a00999922e7f737a0cc4e05ac", + "rev": "312f0eb723d9b2a1539f175bca9f11f1e4f0a673", "type": "github" }, "original": { @@ -28,7 +28,6 @@ buildInputs = [ openssl zlib libopus ]; cmakeFlags = [ "-DCMAKE_CXX_STANDARD=20" - "-DCMAKE_BUILD_TYPE=Release" "-DBUILD_TEST=OFF" "-DBUILD_EXAMPLES=OFF" ]; |
