mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-bot_template.git
synced 2024-11-17 13:53:52 +00:00
add dockerfile environment
This commit is contained in:
parent
e86d07d25d
commit
fcc0b49576
9
Dockerfile
Normal file
9
Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM adoptopenjdk/openjdk11
|
||||
|
||||
USER 1000
|
||||
|
||||
VOLUME /config.json
|
||||
|
||||
ENTRYPOINT ["/telegram_bot/bin/telegram_bot", "TOKEN"]
|
||||
|
||||
ADD ./build/distributions/telegram_bot.tar /
|
19
Makefile
Normal file
19
Makefile
Normal file
@ -0,0 +1,19 @@
|
||||
#!make
|
||||
|
||||
.ONESHELL:
|
||||
.PHONY:
|
||||
|
||||
clean:
|
||||
./gradlew clean
|
||||
|
||||
build:
|
||||
./gradlew build
|
||||
|
||||
start:
|
||||
./gradlew run
|
||||
|
||||
startCompose:
|
||||
docker-compose build && docker-compose up
|
||||
|
||||
buildAndStartCompose:
|
||||
make clean build startCompose
|
@ -17,6 +17,13 @@ output you will get your bot information like:
|
||||
ExtendedBot(id=ChatId(chatId=1234567890), username=Username(username=@username_of_your_bot), firstName=Name of bot, lastName=, canJoinGroups=(some boolean), canReadAllGroupMessages=(some boolean), supportsInlineQueries=(some boolean))
|
||||
```
|
||||
|
||||
### Docker
|
||||
|
||||
In this template there is template-like [docker-compose](docker-compose.yml) and [docker](Dockerfile) files. Besides,
|
||||
there is [Makefile](Makefile) and you may use something like `make buildAndStartCompose` to start your bot.
|
||||
|
||||
It is important to replace `"TOKEN"` in [Dockerfile](Dockerfile) or remove and add some config as a volume.
|
||||
|
||||
## What next?
|
||||
|
||||
There are several ways to continue:
|
||||
|
@ -28,3 +28,8 @@ dependencies {
|
||||
application {
|
||||
mainClassName = 'telegram_bot.AppKt'
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
|
6
docker-compose.yml
Normal file
6
docker-compose.yml
Normal file
@ -0,0 +1,6 @@
|
||||
version: "3.4"
|
||||
|
||||
services:
|
||||
server:
|
||||
build: .
|
||||
restart: unless-stopped
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -27,5 +27,9 @@ suspend fun main(args: Array<String>) {
|
||||
// simply reply :)
|
||||
reply(it, "Hello, I am ${me.firstName}")
|
||||
}
|
||||
|
||||
// That will be called on the end of bot initiation. After that prinln will be started long polling and bot will
|
||||
// react on your commands
|
||||
println(me)
|
||||
}.join()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user