mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
build: Publish Docker container
This commit is contained in:
65
.github/workflows/build.yml
vendored
Normal file
65
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
name: Build and Publish Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
IMAGE_TAG: ${{ github.sha }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout Dockerfile
|
||||
id: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup QEMU
|
||||
id: qemu
|
||||
uses: docker/setup-qemu-action@v3
|
||||
with:
|
||||
image: tonistiigi/binfmt:latest
|
||||
platforms: all
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
id: ghcr
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GH_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
flavor: |
|
||||
latest=${{ startsWith(github.ref, 'refs/heads/main') }}
|
||||
suffix=-${{ github.sha }}
|
||||
|
||||
- name: Build and push main Docker image
|
||||
id: build
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
build-args: GH_TOKEN=${{ secrets.GH_TOKEN }}
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/arm64/v8
|
||||
cache-to: type=gha,mode=max,ignore-error=true
|
||||
cache-from: type=gha
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
25
Dockerfile
Normal file
25
Dockerfile
Normal file
@@ -0,0 +1,25 @@
|
||||
FROM node:latest
|
||||
|
||||
ENV WIT_AI_TOKEN $WIT_AI_TOKEN
|
||||
ENV MONGODB_URI $MONGODB_URI
|
||||
ENV DISCORD_TOKEN $DISCORD_TOKEN
|
||||
|
||||
# Create app directory and install dependencies
|
||||
WORKDIR /usr/src/revanced-helper
|
||||
COPY . .
|
||||
RUN npm i
|
||||
|
||||
# Install the server
|
||||
WORKDIR /usr/src/revanced-helper/apps/server/src
|
||||
RUN npm i
|
||||
|
||||
# Install the client for the server
|
||||
WORKDIR /usr/src/revanced-helper/packages/client
|
||||
RUN npm i
|
||||
|
||||
# Install the bot
|
||||
WORKDIR /usr/src/revanced-helper/apps/bot-discord/src
|
||||
RUN npm i
|
||||
|
||||
WORKDIR /usr/src/revanced-helper
|
||||
CMD ["npm", "run", "start"]
|
||||
95
apps/bot-discord/src/package-lock.json
generated
95
apps/bot-discord/src/package-lock.json
generated
@@ -16,14 +16,6 @@
|
||||
"parse-duration": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"../../../packages/client": {
|
||||
"name": "@revanced-helper/helper-client",
|
||||
"version": "1.0.0",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"bson": "^4.7.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/builders": {
|
||||
"version": "1.6.3",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.6.3.tgz",
|
||||
@@ -115,8 +107,23 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@revanced-helper/helper-client": {
|
||||
"resolved": "../../../packages/client",
|
||||
"link": true
|
||||
"version": "1.0.0",
|
||||
"resolved": "file:../../../packages/client",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"bson": "^4.7.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@revanced-helper/helper-client/node_modules/bson": {
|
||||
"version": "4.7.2",
|
||||
"resolved": "https://registry.npmjs.org/bson/-/bson-4.7.2.tgz",
|
||||
"integrity": "sha512-Ry9wCtIZ5kGqkJoi6aD8KjxFZEx78guTQDnpXWiNthsxzrxAK/i8E6pCHAIZTbaEFWcOCvbecMukfK7XUvyLpQ==",
|
||||
"dependencies": {
|
||||
"buffer": "^5.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@sapphire/async-queue": {
|
||||
"version": "1.5.0",
|
||||
@@ -370,6 +377,25 @@
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/bson": {
|
||||
"version": "5.4.0",
|
||||
"resolved": "https://registry.npmjs.org/bson/-/bson-5.4.0.tgz",
|
||||
@@ -378,6 +404,29 @@
|
||||
"node": ">=14.20.1"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.1.13"
|
||||
}
|
||||
},
|
||||
"node_modules/busboy": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz",
|
||||
@@ -858,9 +907,19 @@
|
||||
}
|
||||
},
|
||||
"@revanced-helper/helper-client": {
|
||||
"version": "file:../../../packages/client",
|
||||
"version": "1.0.0",
|
||||
"requires": {
|
||||
"bson": "^4.7.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"bson": {
|
||||
"version": "4.7.2",
|
||||
"resolved": "https://registry.npmjs.org/bson/-/bson-4.7.2.tgz",
|
||||
"integrity": "sha512-Ry9wCtIZ5kGqkJoi6aD8KjxFZEx78guTQDnpXWiNthsxzrxAK/i8E6pCHAIZTbaEFWcOCvbecMukfK7XUvyLpQ==",
|
||||
"requires": {
|
||||
"buffer": "^5.6.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@sapphire/async-queue": {
|
||||
@@ -991,11 +1050,25 @@
|
||||
"resolved": "https://registry.npmjs.org/@vladfrangu/async_event_emitter/-/async_event_emitter-2.2.2.tgz",
|
||||
"integrity": "sha512-HIzRG7sy88UZjBJamssEczH5q7t5+axva19UbZLO6u0ySbYPrwzWiXBcC0WuHyhKKoeCyneH+FvYzKQq/zTtkQ=="
|
||||
},
|
||||
"base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
||||
},
|
||||
"bson": {
|
||||
"version": "5.4.0",
|
||||
"resolved": "https://registry.npmjs.org/bson/-/bson-5.4.0.tgz",
|
||||
"integrity": "sha512-WRZ5SQI5GfUuKnPTNmAYPiKIof3ORXAF4IRU5UcgmivNIon01rWQlw5RUH954dpu8yGL8T59YShVddIPaU/gFA=="
|
||||
},
|
||||
"buffer": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||
"requires": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.1.13"
|
||||
}
|
||||
},
|
||||
"busboy": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz",
|
||||
|
||||
2
apps/server/src/package-lock.json
generated
2
apps/server/src/package-lock.json
generated
@@ -7,7 +7,7 @@
|
||||
"": {
|
||||
"name": "server",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"bson": "^5.3.0",
|
||||
"tesseract.js": "^4.1.0"
|
||||
|
||||
15
docker-compose.yml
Normal file
15
docker-compose.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
revanced-helper:
|
||||
container_name: revanced-helper
|
||||
image: ghcr.io/revanced/revanced-helper:latest
|
||||
# Required because otherwise failing with ECONNREFUSED
|
||||
network_mode: "host"
|
||||
environment:
|
||||
- WIT_AI_TOKEN=YOUR_WIT_AI_TOKEN
|
||||
- MONGODB_URI=YOUR_MONGODB_URI
|
||||
- DISCORD_TOKEN=YOUR_DISCORD_TOKEN
|
||||
volumes:
|
||||
- /data/revanced-helper/discord-bot-config.json:/usr/src/revanced-helper/apps/bot-discord/src/config.json
|
||||
- /data/revanced-helper/server-config.json:/usr/src/revanced-helper/apps/server/src/config.json
|
||||
@@ -14,11 +14,10 @@
|
||||
"homepage": "https://github.com/reisxd/revanced-helper#readme",
|
||||
"scripts": {
|
||||
"lint": "prettier --write . && eslint --fix .",
|
||||
"installPackages": "cd bots && npm i && cd ../client && npm i && cd ../server && npm i",
|
||||
"start": "cd bots && node . & cd ../server && node ."
|
||||
"start": "cd apps/server/src && (node . &) && cd ../../bot-discord/src && (node .)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.27.0",
|
||||
"prettier": "2.7.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,4 +12,4 @@
|
||||
"dependencies": {
|
||||
"bson": "^4.7.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user