-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
74 additions
and
2,415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Publish Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*.*" | ||
|
||
jobs: | ||
tag-release: | ||
name: Publish Release | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Publish Release | ||
uses: Leomotors/auto-publish-release@main | ||
with: | ||
githubToken: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ github.ref }} | ||
title: "Bots Gulag" | ||
|
||
docker-push: | ||
name: Build Docker Image | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
id-token: write | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
name: Check out code | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: true | ||
tags: ghcr.io/carelessdev/bots-gulag:${{ github.ref_name }},ghcr.io/carelessdev/bots-gulag:latest | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM oven/bun as installer | ||
|
||
COPY package.json bun.lockb ./ | ||
|
||
RUN bun install --production --frozen-lockfile | ||
|
||
FROM oven/bun as runner | ||
|
||
USER bun | ||
|
||
COPY --chown=bun:bun src ./src | ||
COPY --chown=bun:bun package.json ./ | ||
COPY --chown=bun:bun --from=installer /home/bun/app/node_modules ./node_modules | ||
|
||
CMD ["bun", "run", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,4 @@ | ||
# Bots Gulag | ||
|
||
## Problem | ||
|
||
Our server has many bots, but most of them doing nothing. | ||
|
||
Literally just online. | ||
|
||
By running many process, this is very laggy especially when [cocoa-grader](https://github.com/Leomotors/cocoa-grader) | ||
the bots that use so many resources came in. | ||
|
||
## Solution | ||
|
||
Why not run all bots in a single process? | ||
|
||
~~A study~~ shows that a bare nodejs process take a lot of RAM | ||
Run 5 Discord Bots in the same process to make server feels active and not dead. | ||
(It actually dead :skull:) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,20 +5,15 @@ | |
"repository": "https://github.com/CarelessDev/bots-gulag", | ||
"type": "module", | ||
"private": true, | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"build": "tsc", | ||
"clean": "rimraf dist/*", | ||
"cb": "yarn clean && yarn build", | ||
"start": "node dist/bot.js", | ||
"start": "bun run src/bot.ts", | ||
"format": "eslint . --fix", | ||
"lint": "eslint . --max-warnings=0" | ||
}, | ||
"dependencies": { | ||
"chalk": "5.3.0", | ||
"cocoa-discord-utils": "2.3.0", | ||
"discord.js": "14.13.0", | ||
"dotenv": "16.3.1", | ||
"zod": "3.22.2" | ||
}, | ||
"devDependencies": { | ||
|
@@ -27,6 +22,10 @@ | |
"@typescript-eslint/eslint-plugin": "6.6.0", | ||
"@typescript-eslint/parser": "6.6.0", | ||
"eslint": "8.49.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-import": "^2.28.1", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"eslint-plugin-sort-destructure-keys": "^1.5.0", | ||
"prettier": "3.0.3", | ||
"typescript": "5.2.2" | ||
} | ||
|
Oops, something went wrong.