From 890703275a49e7a7d42e5f39816b8e58f5828261 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 3 Jul 2022 18:58:41 +0200 Subject: [PATCH 1/5] Add docker file --- docker/Dockerfile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 docker/Dockerfile diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..3e8d8d1 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,17 @@ +# syntax=docker/dockerfile:1 + +FROM node:16.15.0-alpine3.15 + +RUN apk add dumb-init + +ENV NODE_ENV=production + +USER botanique + +WORKDIR /app + +COPY --chown=botanique:botanique . . + +RUN npm ci --only=production + +CMD ["dumb-init", "node", "src/index.js"] -- 2.45.2 From 98cbd3c74e50f17d20a59a7776677dc2514ae5f5 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 3 Jul 2022 19:01:57 +0200 Subject: [PATCH 2/5] Move dockerfiler to root --- docker/Dockerfile => Dockerfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docker/Dockerfile => Dockerfile (100%) diff --git a/docker/Dockerfile b/Dockerfile similarity index 100% rename from docker/Dockerfile rename to Dockerfile -- 2.45.2 From 24a1a6cc5ebe125c8213e8d22e925c229f56b040 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 3 Jul 2022 19:10:12 +0200 Subject: [PATCH 3/5] change container user --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3e8d8d1..92de552 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,11 +6,11 @@ RUN apk add dumb-init ENV NODE_ENV=production -USER botanique +USER node WORKDIR /app -COPY --chown=botanique:botanique . . +COPY --chown=node:node . . RUN npm ci --only=production -- 2.45.2 From 5fd4d70bfb666f4e2731f1f38c9c83c6028b8437 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 3 Jul 2022 19:16:48 +0200 Subject: [PATCH 4/5] trim newlines --- Dockerfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 92de552..aee3676 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,15 +3,11 @@ FROM node:16.15.0-alpine3.15 RUN apk add dumb-init - ENV NODE_ENV=production - USER node - WORKDIR /app COPY --chown=node:node . . RUN npm ci --only=production - CMD ["dumb-init", "node", "src/index.js"] -- 2.45.2 From f81f7fe4c8fd3f2295c967e1d312772f661f6195 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 3 Jul 2022 19:16:54 +0200 Subject: [PATCH 5/5] Add docker way --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9982982..519acb2 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ### En local > Cloner le repo. -> Spécifier un fichier `.env` en suivant l'exemple [de l'exemple](example.env). +> Spécifier un fichier `.env` en suivant [l'exemple](config/example.env). > Installer les dépendences du bot. ```bash @@ -18,6 +18,19 @@ npm install npm run main ``` +### Avec Docker (Recommandé) +> Facile avec `docker-compose` +```docker +version: "3.9" +services: + botanique: + build: https://git.kennel.ml/ConfrerieDuKassoulait/Botanique.git#main + container_name: Botanique + environment: + - TOKEN_DISCORD=your-token-goes-here + restart: unless-stopped +``` + --- ### Références [Photo de profil](https://picrew.me/image_maker/1497656) -- 2.45.2