final preparings to test

This commit is contained in:
InsanusMokrassar 2022-09-07 20:40:01 +06:00
parent d33e8971eb
commit e764358929
6 changed files with 58 additions and 10 deletions

1
.gitignore vendored
View File

@ -10,5 +10,6 @@ build/
out/
local.*
local/
local.*/
secret.gradle

View File

@ -1,8 +0,0 @@
FROM adoptopenjdk/openjdk11
USER 1000
ENTRYPOINT ["/telegram_bot/bin/telegram_bot", "/telegram_bot/local.config.json"]
ADD ./build/distributions/telegram_bot.tar /
ADD ./local.config.json /telegram_bot/

View File

@ -17,10 +17,10 @@ ExtendedBot(id=ChatId(chatId=1234567890), username=Username(username=@username_o
### Docker
In this template there is template-like [docker-compose](docker-compose.yml) and [docker](Dockerfile) files. Besides,
In this template there is template-like [docker-compose](docker-compose.yml) and [docker](sample.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.
It is important to replace `"TOKEN"` in [Dockerfile](sample.Dockerfile) or remove and add some config as a volume.
## What next?

7
sample.Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM adoptopenjdk/openjdk11
USER 1000
ENTRYPOINT ["/booru_grabber_bot/bin/booru_grabber_bot", "/booru_grabber_bot/local.config.json"]
ADD ./build/distributions/booru_grabber_bot.tar /

26
sample.deploy.sh Normal file
View File

@ -0,0 +1,26 @@
#!/bin/bash
function send_notification() {
echo "$1"
}
function assert_success() {
"${@}"
local status=${?}
if [ ${status} -ne 0 ]; then
send_notification "### Error ${status} at: ${BASH_LINENO[*]} ###"
exit ${status}
fi
}
app=booru_grabber_bot
version=0.0.1
server=hub.docker.com
assert_success ../gradlew build
# scp ./build/distributions/AutoPostTestTelegramBot-1.0.0.zip ./config.json developer@insanusmokrassar.dev:/tmp/
assert_success sudo docker build -t $app:"$version" .
assert_success sudo docker tag $app:"$version" $server/$app:$version
assert_success sudo docker tag $app:"$version" $server/$app:latest
assert_success sudo docker push $server/$app:$version
assert_success sudo docker push $server/$app:latest

22
sample.docker-compose.yml Normal file
View File

@ -0,0 +1,22 @@
version: "3.4"
services:
booru_grabber_bot_postgres:
image: postgres
container_name: "booru_grabber_bot_postgres"
environment:
POSTGRES_USER: "${PG_USER}"
POSTGRES_PASSWORD: "${PG_PASSWORD}"
POSTGRES_DB: "${PG_DB}"
volumes:
- "${DATA_PATH}/db/:/var/lib/postgresql/"
booru_grabber_bot:
image: hub.docker.com/booru_grabber_bot
container_name: "booru_grabber_bot"
restart: "unless-stopped"
volumes:
- "${DATA_PATH}/config.json:/config.json"
links:
- "booru_grabber_bot_postgres:postgres"
depends_on:
- "booru_grabber_bot_postgres"