implement proper docker compose with database

This commit is contained in:
mykola2312 2024-03-09 07:23:26 +02:00
parent 2f300b2759
commit a7d9a85efa
4 changed files with 21 additions and 13 deletions

View file

@ -1,9 +0,0 @@
services:
mk-dl-bot:
build: .
env_file:
- .env
volumes:
- db:/var/lib/mk-dl-bot
volumes:
db:

View file

@ -1,5 +1,23 @@
services:
mk-dl-bot:
postgresdb:
image: postgres:alpine
env_file:
- .env
volumes:
- db:/var/lib/postgres
healthcheck:
test: ["CMD", "pg_isready"]
interval: 1m30s
timeout: 30s
retries: 5
start_period: 30s
bot:
build: .
env_file:
- .env
depends_on:
- postgresdb
restart: on-failure
volumes:
db:

View file

@ -130,7 +130,6 @@ enum Command {
async fn cmd_test(bot: Bot, msg: Message, _db: DbPool) -> HandlerResult {
bot.send_message(msg.chat.id, t!("test_response")).await?;
dbg!(msg);
Ok(())
}

View file

@ -18,7 +18,7 @@ rust_i18n::i18n!("locales");
#[tokio::main]
async fn main() -> anyhow::Result<()> {
if cfg!(debug_assertions) {
dotenv().ok();
dotenv::from_filename(".env.dev").ok();
}
log_init();