golem telegram bot dockerized

This commit is contained in:
giomba 2020-12-05 22:47:55 +01:00
parent 9ed12c4ad2
commit 2f644a0b51
7 changed files with 84 additions and 0 deletions

13
tgbot/000-default.conf Normal file
View File

@ -0,0 +1,13 @@
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory /var/www/html>
Options -Indexes
</Directory>
ErrorLog /dev/stodut
CustomLog /dev/stdout combined
TransferLog /dev/stdout
</VirtualHost>

19
tgbot/Dockerfile Normal file
View File

@ -0,0 +1,19 @@
FROM php:7.4-apache
RUN apt-get update
RUN apt-get install -y git
RUN apt-get install -y libmemcached-dev zlib1g-dev && pecl install memcached-3.1.5 && docker-php-ext-enable memcached
RUN cd /var/www/html && git clone --depth 1 https://git.golem.linux.it/golem/golem-telegram-bot.git
RUN docker-php-ext-install calendar && docker-php-ext-configure calendar
RUN docker-php-ext-install mysqli
RUN cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini
RUN apt-get install -y cron
COPY tgbot.cron /etc/cron.hourly/
COPY entrypoint.sh /
EXPOSE 80
CMD ["/entrypoint.sh"]

16
tgbot/README.md Normal file
View File

@ -0,0 +1,16 @@
# tgbot, a docker image for golem-telegram-bot
## Build
```
docker build --tag hub.docker.golem.linux.it/golem-telegram-bot:latest .
```
## Permissions
```
drwxrwxr-x root www-data /data
```
## Bot development
* mount golem-telegram-bot repository as volume under /var/www/html
* ```mv $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.ini```
(this enables error loggin on docker stdout/stderr logs)

View File

@ -0,0 +1,16 @@
version: "3.3"
services:
tgbot:
image: hub.docker.golem.linux.it/golem-telegram-bot:latest
restart: unless-stopped
ports:
- "7002:80"
volumes:
- /home/giomba/workspace/golem/golem-telegram-bot:/var/www/html
- /srv/tgbot/data:/data
depends_on:
- memcached
memcached:
image: memcached:1.6.9

15
tgbot/docker-compose.yml Normal file
View File

@ -0,0 +1,15 @@
version: "3.3"
services:
tgbot:
image: hub.docker.golem.linux.it/golem-telegram-bot:latest
restart: unless-stopped
ports:
- "7002:80"
volumes:
- /srv/tgbot/data:/data
depends_on:
- memcached
memcached:
image: memcached:1.6.9

3
tgbot/entrypoint.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
service cron start
apachectl -D FOREGROUND

2
tgbot/tgbot.cron Executable file
View File

@ -0,0 +1,2 @@
php /var/www/html/schedule.php