mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-04-28 09:15:57 +00:00
docker/docs: dockerize and add+modify documentation
This commit is contained in:
parent
62e7a1393b
commit
429e89bf1d
8
.dockerignore
Normal file
8
.dockerignore
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
.env
|
||||||
|
config.env
|
||||||
|
*.md
|
||||||
|
!README.md
|
18
Dockerfile
Normal file
18
Dockerfile
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
FROM node:20-slim
|
||||||
|
|
||||||
|
# Install ffmpeg and other deps
|
||||||
|
RUN apt-get update && apt-get install -y ffmpeg && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN chmod +x /usr/src/app/src/plugins/yt-dlp/yt-dlp
|
||||||
|
|
||||||
|
VOLUME /usr/src/app/config.env
|
||||||
|
|
||||||
|
CMD ["npm", "start"]
|
45
README.md
45
README.md
@ -9,10 +9,10 @@ Kowalski is a a simple Telegram bot made in Node.js.
|
|||||||
|
|
||||||
## Self-host requirements
|
## Self-host requirements
|
||||||
|
|
||||||
- Node.js 20 or newer (you can also use Bun)
|
- Node.js 20 or newer (you can also use [Bun](https://bun.sh))
|
||||||
- A Telegram bot (create one at [@BotFather](https://t.me/botfather))
|
- A Telegram bot (create one at [@BotFather](https://t.me/botfather))
|
||||||
- Latest version of Node.js
|
|
||||||
- FFmpeg (only for the `/yt` command)
|
- FFmpeg (only for the `/yt` command)
|
||||||
|
- Docker and Docker Compose (only required for Docker setup)
|
||||||
|
|
||||||
## Run it yourself, develop or contribute with Kowalski
|
## Run it yourself, develop or contribute with Kowalski
|
||||||
|
|
||||||
@ -36,6 +36,47 @@ After editing the file, save all changes and run the bot with ``npm start``.
|
|||||||
> [!TIP]
|
> [!TIP]
|
||||||
> To deal with dependencies, just run ``npm install`` or ``npm i`` at any moment to install all of them.
|
> To deal with dependencies, just run ``npm install`` or ``npm i`` at any moment to install all of them.
|
||||||
|
|
||||||
|
## Running with Docker
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> Please complete the above steps to prepare your local copy for building. You do not need to install FFmpeg on your host system.
|
||||||
|
|
||||||
|
You can also run Kowalski using Docker, which simplifies the setup process. Make sure you have Docker and Docker Compose installed.
|
||||||
|
|
||||||
|
### Using Docker Compose
|
||||||
|
|
||||||
|
1. **Make sure to setup your `config.env` file first!**
|
||||||
|
|
||||||
|
2. **Run the container**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> The `-d` flag causes the bot to run in the background. If you're just playing around, you may not want to use this flag.
|
||||||
|
|
||||||
|
### Using Docker Run
|
||||||
|
|
||||||
|
If you prefer to use Docker directly, you can use these instructions instead.
|
||||||
|
|
||||||
|
1. **Make sure to setup your `config.env` file first!**
|
||||||
|
|
||||||
|
2. **Build the image**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build -t kowalski .
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Run the container**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -d --name kowalski --restart unless-stopped -v $(pwd)/config.env:/usr/src/app/config.env:ro kowalski
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> The `-d` flag causes Kowalski to run in the background. If you're just playing around, you may not want to use this flag.
|
||||||
|
|
||||||
## config.env Functions
|
## config.env Functions
|
||||||
|
|
||||||
- **botSource**: Put the link to your bot source code.
|
- **botSource**: Put the link to your bot source code.
|
||||||
|
9
docker-compose.yml
Normal file
9
docker-compose.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
services:
|
||||||
|
kowalski:
|
||||||
|
build: .
|
||||||
|
container_name: kowalski
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./config.env:/usr/src/app/config.env:ro
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
Loading…
x
Reference in New Issue
Block a user