mirror of
https://github.com/gabrielkheisa/discord-active-developer-badge.git
synced 2024-11-21 19:12:00 +07:00
deployment for Docker
This commit is contained in:
parent
11eb8aa2e5
commit
82ee4813fa
31
.github/workflows/main.yml
vendored
31
.github/workflows/main.yml
vendored
@ -18,3 +18,34 @@ jobs:
|
||||
|
||||
- name: Build Docker image
|
||||
run: docker build -t discord-badge .
|
||||
|
||||
- name: Run Docker container
|
||||
run: |
|
||||
docker run -d -e TOKEN=${{ secrets.DISCORD_TOKEN }} discord-badge
|
||||
|
||||
|
||||
|
||||
|
||||
name: Publish Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main # Trigger the workflow on pushes to the main branch
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Login to GitHub Packages Docker registry
|
||||
run: echo "${{ secrets.GH_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.repository_owner }} --password-stdin
|
||||
|
||||
- name: Build Docker image
|
||||
run: docker build -t docker.pkg.github.com/${{ github.repository }}/discord-badge:latest .
|
||||
|
||||
- name: Push Docker image
|
||||
run: docker push docker.pkg.github.com/${{ github.repository }}/discord-badge:latest
|
||||
|
@ -22,8 +22,5 @@ WORKDIR /usr/src/app
|
||||
# Copy the built artifacts from the builder stage to the production stage
|
||||
COPY --from=builder /usr/src/app .
|
||||
|
||||
# Expose the port the app runs on
|
||||
EXPOSE 3000
|
||||
|
||||
# Command to run the application in the production stage
|
||||
CMD ["node", "index.js"]
|
||||
|
@ -46,7 +46,7 @@ docker build -t discord-badge .
|
||||
```
|
||||
3. Run the container and insert your Discord bot token
|
||||
```bash
|
||||
docker run -it -p 3000:3000 discord-badge
|
||||
docker run -d -e TOKEN=<your_bot_token> discord-badge
|
||||
```
|
||||
4. Jump directly to step 12 and follow the remaining steps from the main instruction
|
||||
|
||||
|
2
index.js
2
index.js
@ -34,7 +34,7 @@ client.on('interactionCreate', (interaction) => {
|
||||
|
||||
const question = (q) => new Promise((resolve) => rl.question(q, resolve));
|
||||
(async ()=>{
|
||||
const token = await question('Application token? ');
|
||||
const token = process.env.TOKEN;
|
||||
if(!token) throw new Error('Invalid token');
|
||||
|
||||
const ratelimitTest = await fetch(`https://discord.com/api/v9/invites/discord-developers`);
|
||||
|
Loading…
Reference in New Issue
Block a user