Skip to content

Commit 5b41c99

Browse files
arduinocraftgabrielkheisa
authored andcommitted
update for self-deploy using Docker
update update update for self-deploy using Docker
1 parent 8c57260 commit 5b41c99

File tree

3 files changed

+82
-21
lines changed

3 files changed

+82
-21
lines changed

.github/workflows/main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Docker Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
19+
- name: Build Docker image
20+
run: docker build -t discord-badge .

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Stage 1: Build stage
2+
FROM node:16 AS builder
3+
4+
# Set the working directory in the builder stage
5+
WORKDIR /usr/src/app
6+
7+
# Copy the package.json and package-lock.json files to the builder stage
8+
COPY package*.json ./
9+
10+
# Install npm dependencies in the builder stage
11+
RUN npm install
12+
13+
# Copy the rest of the application code to the builder stage
14+
COPY . .
15+
16+
# Stage 2: Production stage
17+
FROM node:16-alpine
18+
19+
# Set the working directory in the production stage
20+
WORKDIR /usr/src/app
21+
22+
# Copy the built artifacts from the builder stage to the production stage
23+
COPY --from=builder /usr/src/app .
24+
25+
# Expose the port the app runs on
26+
EXPOSE 3000
27+
28+
# Command to run the application in the production stage
29+
CMD ["node", "index.js"]

README.md

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,40 @@ If you're still learning and want the badge, follow the instructions below!
1515

1616

1717
# Instructions
18-
19-
- Go to https://discord.com/developers/applications, and create a new application on the account you want the badge on.
20-
- Go to the bot tab and generate a bot account for the application.
21-
- Click the "Reset Token" button to generate a token (if you have 2fa enabled, you'll need your code).
22-
- Copy the token to your clipboard.
23-
- Click this badge to clone this repo to a new repl in Replit -> [![Run on Repl.it](https://replit.com/badge/github/hackermondev/discord-active-developer-badge)](https://replit.com/new/github/hackermondev/discord-active-developer-badge)
24-
- You will be redirected to Replit, you might have to create an account (you can Register with Google).
18+
1. Go to https://discord.com/developers/applications, and create a new application on the account you want the badge on.
19+
2. Go to the bot tab and generate a bot account for the application.
20+
3. Click the "Reset Token" button to generate a token (if you have 2fa enabled, you'll need your code).
21+
4. Copy the token to your clipboard.
22+
5. Click this badge to clone this repo to a new repl in Replit -> [![Run on Repl.it](https://replit.com/badge/github/hackermondev/discord-active-developer-badge)](https://replit.com/new/github/hackermondev/discord-active-developer-badge)
23+
6. You will be redirected to Replit, you might have to create an account (you can Register with Google).
2524
- Replit is a website, and does not run off your computer!
26-
- Wait for the repo has finished cloning and the repl to fully connect.
27-
- Click the green "Run" button at the top.
28-
- Go to the console (big black square on the right) and paste in the token you copied earlier (**Note**: ``CTRL + V`` won't work, you'll need to do ``CTRL + Shift + V`` or right-click and click paste).
29-
- Press the 'Enter' key.
30-
- Wait for it to print 'DONE | Application/Bot is up and running. DO NOT CLOSE THIS TAB UNLESS YOU ARE FINISHED USING THE BOT, IT WILL PUT THE BOT OFFLINE.' in the console, **DON'T STOP THE PROGRAM OR CLOSE THE TAB YET OR THE BOT WILL CONSIDERED BY DISCORD AS 'UNRESPONSIVE'**
31-
- Go back to the application page, go to the "General Information" tab, scroll down and copy application id.
32-
- Create a new discord server (you can delete it at the end).
33-
- Enable community on the server (you only need to do this if you don't own any other discord server with community enabled)
34-
- Return back to https://discord.com/developers/applications.
35-
- Copy the application id.
36-
- Use this invite link to add the application to the server: (replace ``{applicationid}`` with what you copied) ``https://discord.com/oauth2/authorize?client_id={applicationid}&scope=bot%20applications.commands&permissions=105227086912``
37-
- In the server, go to a channel and use the ``/ping`` command on the bot.
38-
- Go to the <https://discord.com/developers/active-developer> page and register everything (**if it says you're not eligible, it's because you're not registered in their system yet. you might have to wait up to 24 hours**).
39-
- Congrats on that shiny new badge.
25+
7. Wait for the repo has finished cloning and the repl to fully connect.
26+
8. Click the green "Run" button at the top.
27+
9. Go to the console (big black square on the right) and paste in the token you copied earlier (**Note**: ``CTRL + V`` won't work, you'll need to do ``CTRL + Shift + V`` or right-click and click paste).
28+
10. Press the 'Enter' key.
29+
11. Wait for it to print 'DONE | Application/Bot is up and running. DO NOT CLOSE THIS TAB UNLESS YOU ARE FINISHED USING THE BOT, IT WILL PUT THE BOT OFFLINE.' in the console, **DON'T STOP THE PROGRAM OR CLOSE THE TAB YET OR THE BOT WILL CONSIDERED BY DISCORD AS 'UNRESPONSIVE'**
30+
12. Go back to the application page, go to the "General Information" tab, scroll down and copy application id.
31+
13. Create a new discord server (you can delete it at the end).
32+
14. Enable community on the server (you only need to do this if you don't own any other discord server with community enabled)
33+
15. Return back to https://discord.com/developers/applications.
34+
16. Copy the application id.
35+
17. Use this invite link to add the application to the server: (replace ``{applicationid}`` with what you copied) ``https://discord.com/oauth2/authorize?client_id={applicationid}&scope=bot%20applications.commands&permissions=105227086912``
36+
18. In the server, go to a channel and use the ``/ping`` command on the bot.
37+
19. Go to the <https://discord.com/developers/active-developer> page and register everything (**if it says you're not eligible, it's because you're not registered in their system yet. you might have to wait up to 24 hours**).
38+
20. Congrats on that shiny new badge.
39+
40+
## Instructions with Docker
41+
### With Dockerfile
42+
1. Follow step 1 to 4 from the main instruction above
43+
2. Build the Dockerfile
44+
```bash
45+
docker build -t discord-badge .
46+
```
47+
3. Run the container and insert your Discord bot token
48+
```bash
49+
docker run -it -p 3000:3000 discord-badge
50+
```
51+
4. Jump directly to step 12 and follow the remaining steps from the main instruction
4052

4153

4254
**NOTE:** Make sure you have the “Use data to improve Discord” setting enabled under User Settings > Privacy & Safety otherwise you won't be able to be marked as eligible.

0 commit comments

Comments
 (0)