From 566470ec1270d43e176d0e04d7d36c6168dcd86f Mon Sep 17 00:00:00 2001 From: H4CK3R-01 Date: Mon, 25 Apr 2022 17:05:21 +0200 Subject: [PATCH] Updated Dockerfiles to use second container for bot updates --- .woodpecker/pipeline.yml | 19 ++++++++++++++++++- deploy/aktienbot/docker-compose.yml | 5 +++++ telegram_bot/{Dockerfile => Dockerfile.bot} | 8 +------- telegram_bot/Dockerfile.updates | 14 ++++++++++++++ 4 files changed, 38 insertions(+), 8 deletions(-) rename telegram_bot/{Dockerfile => Dockerfile.bot} (66%) create mode 100644 telegram_bot/Dockerfile.updates diff --git a/.woodpecker/pipeline.yml b/.woodpecker/pipeline.yml index 7a0d6a1..8551885 100644 --- a/.woodpecker/pipeline.yml +++ b/.woodpecker/pipeline.yml @@ -39,7 +39,24 @@ pipeline: from_secret: password registry: from_secret: registry - dockerfile: telegram_bot/Dockerfile + dockerfile: telegram_bot/Dockerfile.bot + platforms: linux/amd64 + when: + path: "telegram_bot/**" + event: push + + build_bot_updates: + image: woodpeckerci/plugin-docker-buildx + settings: + repo: + from_secret: repo_bot_updates + username: + from_secret: username + password: + from_secret: password + registry: + from_secret: registry + dockerfile: telegram_bot/Dockerfile.updates platforms: linux/amd64 when: path: "telegram_bot/**" diff --git a/deploy/aktienbot/docker-compose.yml b/deploy/aktienbot/docker-compose.yml index 46aee48..991bbdf 100644 --- a/deploy/aktienbot/docker-compose.yml +++ b/deploy/aktienbot/docker-compose.yml @@ -30,6 +30,11 @@ services: env_file: - ${PWD}/.env.bot + aktienbot_bot_updates: + image: registry.flokaiser.com/aktienbot/bot_updates + env_file: + - ${PWD}/.env.bot + mariadb: image: mariadb volumes: diff --git a/telegram_bot/Dockerfile b/telegram_bot/Dockerfile.bot similarity index 66% rename from telegram_bot/Dockerfile rename to telegram_bot/Dockerfile.bot index 49dd01c..0f2e57e 100644 --- a/telegram_bot/Dockerfile +++ b/telegram_bot/Dockerfile.bot @@ -10,11 +10,5 @@ RUN pip install -r requirements.txt --src /usr/local/src --no-warn-script-locati # Copy the source code to the working directory COPY telegram_bot /srv/flask_app -# Change file permissions -RUN chmod +x ./deploy/start.sh - -# TODO: Set healthcheck -# HEALTHCHECK --interval=15s --timeout=2s CMD ["./deploy/healthcheck.sh"] - # Run the application -CMD ["./deploy/start.sh"] +CMD ["python bot.py"] diff --git a/telegram_bot/Dockerfile.updates b/telegram_bot/Dockerfile.updates new file mode 100644 index 0000000..66d3898 --- /dev/null +++ b/telegram_bot/Dockerfile.updates @@ -0,0 +1,14 @@ +FROM python:3.10-slim + +# Change the working directory to the root of the project +WORKDIR /srv/flask_app + +# Install the dependencies +COPY telegram_bot/requirements.txt /srv/flask_app/ +RUN pip install -r requirements.txt --src /usr/local/src --no-warn-script-location + +# Copy the source code to the working directory +COPY telegram_bot /srv/flask_app + +# Run the application +CMD ["python bot_updates.py"]