Merge pull request 'zorn-dev' (#8) from zorn-dev into PMSManager_refactor

Reviewed-on: SmartSolTech/touchh_bot#8
This commit is contained in:
2025-01-29 07:53:46 +00:00
3 changed files with 37 additions and 32 deletions

1
.dockerignore Normal file
View File

@@ -0,0 +1 @@
/var

View File

@@ -1,7 +1,7 @@
FROM python:3.12-alpine FROM python:3.12-alpine
COPY requirements.txt / COPY requirements.txt /
COPY . .
RUN set -ex ;\ RUN set -ex ;\
apk add --no-cache musl-dev mariadb-connector-c-dev gcc ;\ apk add --no-cache musl-dev mariadb-connector-c-dev gcc ;\
pip3 install -r /requirements.txt ;\ pip3 install -r /requirements.txt ;\

View File

@@ -1,32 +1,36 @@
services: services:
db: db:
image: mariadb:11.6 image: mariadb:11.6
restart: on-failure restart: on-failure
environment: environment:
- MYSQL_RANDOM_ROOT_PASSWORD=1 - MYSQL_RANDOM_ROOT_PASSWORD=1
- MYSQL_DATABASE=touchh - MYSQL_DATABASE=touchh
- MYSQL_USER=touchh - MYSQL_USER=touchh
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-touchh} - MYSQL_PASSWORD=${MYSQL_PASSWORD:-touchh}
volumes: healthcheck:
- ./var/mysql:/var/lib/mysql test: mariadb -utouchh -p${MYSQL_PASSWORD:-touchh} -e 'SELECT 1;' touchh
interval: 1s
bot: timeout: 10s
&py_service retries: 10
build: . volumes:
image: touchh-py - ./var/mysql:/var/lib/mysql
restart: on-failure bot:
command: ['python3', 'manage.py', 'run_bot'] &py_service
depends_on: ['db'] build: .
stop_signal: SIGINT image: touchh-py
volumes: restart: on-failure
- ./:/app command: ['python3', 'manage.py', 'run_bot']
depends_on:
scheduler: db:
<<: *py_service condition: service_healthy
command: ['python3', 'manage.py', 'start_scheduler'] stop_signal: SIGINT
volumes:
web: - .:/app
<<: *py_service scheduler:
command: ['python3', 'manage.py', 'runserver', '0.0.0.0:8000'] <<: *py_service
ports: command: ['python3', 'manage.py', 'start_scheduler']
- "${DOCKER_HTTP_BIND:-8000}:8000" web:
<<: *py_service
command: ['python3', 'manage.py', 'runserver', '0.0.0.0:8000']
ports:
- "${DOCKER_HTTP_BIND:-8000}:8000"