From d04783e2b33bfced96eb4d57e40b4e4ae452b87f Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sat, 25 Sep 2021 22:46:45 +0200 Subject: [PATCH 1/3] Add Makefile --- .gitignore | 1 + Makefile | 10 ++++++++++ README.md | 15 +++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index dbe309b..4801fc7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ venv __pycache__ .env +docker.env .coverage *cookies.txt \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b6afcfd --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +GIT_COMMIT != git log --pretty=format:'%h' -n 1 + +build: + source <(cat docker.env | sed -e 's/^/export /g') + docker build \ + --build-arg DISCORD_BOT_TOKEN=${DISCORD_BOT_TOKEN} \ + --build-arg YOUTUBE_COOKIES=${YOUTUBE_COOKIES} \ + --build-arg GIT_COMMIT=${GIT_COMMIT} \ + -t musicube:${GIT_COMMIT} -t musicube:latest \ + . diff --git a/README.md b/README.md index 045355f..e4b59f9 100644 --- a/README.md +++ b/README.md @@ -34,3 +34,18 @@ Run bot: ``` $ python src/bot.py ``` + +### Deployment + +Requirements: + +``` +$ docker --version +Docker version 20.10.8, build 3967b7d28e +``` + +Build image: + +``` +$ make build +``` From 9843eacd57488791a79c6b28b1bf800ecfc1f3cf Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sat, 25 Sep 2021 22:48:16 +0200 Subject: [PATCH 2/3] Don't handle YOUTUBE_COOKIES different in Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5ea1ea1..d43e2c1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ RUN pip install -r requirements.txt ARG GIT_COMMIT=unset ARG DISCORD_BOT_TOKEN=unset -ARG YOUTUBE_COOKIES=youtube.com_cookies.txt +ARG YOUTUBE_COOKIES=unset ENV DISCORD_BOT_TOKEN=${DISCORD_BOT_TOKEN} YOUTUBE_COOKIES=${YOUTUBE_COOKIES} GIT_COMMIT=${GIT_COMMIT} CMD ["python", "src/bot.py"] From 7cb2cf8eb6c306d75d9d939e049e43ed949dedea Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sat, 25 Sep 2021 23:01:16 +0200 Subject: [PATCH 3/3] Add 'Run image' instructions --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index e4b59f9..bda0477 100644 --- a/README.md +++ b/README.md @@ -49,3 +49,9 @@ Build image: ``` $ make build ``` + +Run image: + +``` +$ docker run --rm --detach --name musicube musicube:latest +```