diff options
| author | soler_j <soler_j@etna-alternance.net> | 2025-04-27 21:02:54 +0200 | 
|---|---|---|
| committer | soler_j <soler_j@etna-alternance.net> | 2025-04-27 21:02:54 +0200 | 
| commit | bef502c22566c78040e2c17d8ecaf4dcad650272 (patch) | |
| tree | 7ec37738e2895912088ab015bb15c5492e0f8f15 /Dockerfile | |
| parent | d497fec2d9d32359428f63595989065c1c9cf5a8 (diff) | |
Suppression du fichier DockerFile, ajout d'un nouveau Dockerfile avec des étapes de compilation pour Go et C++, mise à jour des chemins d'accès et des dépendances, et ajout d'un fichier .dockerignore pour gérer les fichiers à ignorer.
Diffstat (limited to 'Dockerfile')
| -rw-r--r-- | Dockerfile | 53 | 
1 files changed, 53 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..36a2cbd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,53 @@ +# É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/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 +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 && \ +    cp -r /dpp/include/dpp /usr/include/ && \ +    cp /usr/local/lib/libdpp* /usr/lib/ + +# Construction du bot utilisateur +WORKDIR /src +COPY bot/ . + +# Construction en pointant vers DPP installé localement +RUN mkdir build && cd build && \ +    cmake .. && \ +    make -j$(nproc) + +# Étape finale d'exécution +FROM alpine:3.21 +WORKDIR /app + +# 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 + +# Installation des dépendances runtime +RUN apk add --no-cache \ +    libstdc++ \ +    libssl3 \ +    zlib \ +    opus + +RUN chmod +x ./api/app ./bot/build/discord-bot + +ENTRYPOINT ["./api/app"]  | 
