From 50bd98d91e5b8b519b94a79aac6cea15597939de Mon Sep 17 00:00:00 2001 From: Junseo Park Date: Thu, 25 Feb 2021 14:56:54 +0900 Subject: [PATCH] feat: startup script for loading discordbot --- Dockerfile | 2 +- pages/api/index.ts | 2 ++ startup.sh | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 startup.sh diff --git a/Dockerfile b/Dockerfile index f1ddb82..5ec55f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,4 +40,4 @@ RUN yarn build RUN yarn build # Running the app -CMD "yarn" "start" \ No newline at end of file +CMD './startup.sh' \ No newline at end of file diff --git a/pages/api/index.ts b/pages/api/index.ts index f58504d..94d76ee 100644 --- a/pages/api/index.ts +++ b/pages/api/index.ts @@ -2,9 +2,11 @@ import { NextApiRequest, NextApiResponse } from 'next' import nc from 'next-connect' import ResponseWrapper from '@utils/ResponseWrapper' +import { getMainGuild } from '@utils/DiscordBot' const HelloWorld = nc() .get(async(_req, res) => { + getMainGuild() // Load Discord Bot return ResponseWrapper(res, { code: 200, message: '>_<' }) }) diff --git a/startup.sh b/startup.sh new file mode 100644 index 0000000..4ba9285 --- /dev/null +++ b/startup.sh @@ -0,0 +1 @@ +yarn start & (sleep 1; wget http://localhost:3000/api -O /dev/null) \ No newline at end of file