From cee20b41442462f34c74b3a46820625dfaf09630 Mon Sep 17 00:00:00 2001 From: Harsh Raj <42068222+Harshraj9812@users.noreply.github.com> Date: Sun, 24 Mar 2024 13:23:18 +0530 Subject: [PATCH 1/4] Create create-docker-image.yml --- .github/workflows/create-docker-image.yml | 34 +++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/create-docker-image.yml diff --git a/.github/workflows/create-docker-image.yml b/.github/workflows/create-docker-image.yml new file mode 100644 index 000000000..be55c1ecc --- /dev/null +++ b/.github/workflows/create-docker-image.yml @@ -0,0 +1,34 @@ +name: Build MusicBot Docker Image + +on: + workflow_dispatch: + inputs: + musicbot_version: + description: 'Jagrosh/MusicBot version (required) Ex-0.3.9' + required: true + default: '0.3.9' + +jobs: + Build-Push-Docker-Image: + runs-on: ubuntu-latest + env: + musicbot_version: ${{ github.event.inputs.musicbot_version }} + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Building Docker Image + run: | + echo ${musicbot_version} + docker build --build-arg MUSICBOT_VERSION=${musicbot_version} -t ${{ secrets.DOCKER_USERNAME }}/jmusicbot:${musicbot_version} . + + - name: Log in to Docker Hub + env: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + run: | + echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin + + - name: Pushing Docker Image to Docker Hub + run: docker push ${{ secrets.DOCKER_USERNAME }}/jmusicbot:${musicbot_version} From c00fafdc8cd39674886a69eef9b6acc2b4098b90 Mon Sep 17 00:00:00 2001 From: Harsh Raj <42068222+Harshraj9812@users.noreply.github.com> Date: Sun, 24 Mar 2024 13:25:33 +0530 Subject: [PATCH 2/4] Create Dockerfile --- Dockerfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..31e41c3d5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM openjdk:11-jre + +ARG MUSICBOT_VERSION + +WORKDIR / + +RUN pwd +RUN ls -lrt + +ENV TOKEN harsh + +RUN echo "Building MusicBot version: $MUSICBOT_VERSION" + +# Download and rename the JAR file based on the provided version +RUN curl -LJO "https://github.com/jagrosh/MusicBot/releases/download/$MUSICBOT_VERSION/JMusicBot-$MUSICBOT_VERSION.jar" \ + && mv "JMusicBot-$MUSICBOT_VERSION.jar" JMusicBot.jar + +# Copying Repo config.txt file to Build +COPY config.txt /config.txt + +# Replace occurrences of ${BOT-TOKEN} with the value of TOKEN in config.txt during runtime +CMD ["sh", "-c", "sed -i 's/${BOT-TOKEN}/${TOKEN}/g' /config.txt && java -Dnogui=true -jar /JMusicBot.jar"] From 80edae9a326118582c2f5cd8e4a346a380a74b11 Mon Sep 17 00:00:00 2001 From: Harsh Raj <42068222+Harshraj9812@users.noreply.github.com> Date: Sun, 24 Mar 2024 13:27:08 +0530 Subject: [PATCH 3/4] Create docker-compose.yml --- docker-compose.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..62f3893b2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: "3" +services: + discord-bot: + container_name: Discord-Hr-Music-bot + restart: unless-stopped + # Modify Version as per input[0.3.9] + image: [DOCKER HUB USER]/jmusic:[version] + labels: + # This is for Watchtower to Ignore Updating this Image. + - "com.centurylinklabs.watchtower.enable=false" + environment: + # Add your Bot TOken below + - TOKEN=[BOT TOKEN] From f9841bc4ebe87c1c3e6aa3074825709e3d57c795 Mon Sep 17 00:00:00 2001 From: Harsh Raj <42068222+Harshraj9812@users.noreply.github.com> Date: Sat, 6 Apr 2024 12:01:21 +0530 Subject: [PATCH 4/4] Migrated from `openjdk:11-jre` to `amazoncorretto:11-al2023` --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 31e41c3d5..bcb81c762 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:11-jre +FROM amazoncorretto:11-al2023 ARG MUSICBOT_VERSION