1
0
Fork 0
mirror of https://github.com/EDeev/school_menu.git synced 2026-10-07 20:49:36 +03:00

Compare commits

...

2 commits

7 changed files with 65 additions and 1 deletions

4
.dockerignore Normal file
View file

@ -0,0 +1,4 @@
.git
.github
*.md
**/__pycache__

35
.github/workflows/docker.yml vendored Normal file
View file

@ -0,0 +1,35 @@
name: Docker
on:
push:
tags: ["v*"]
workflow_dispatch:
jobs:
image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/edeev/school_menu
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest
- uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

13
Dockerfile Normal file
View file

@ -0,0 +1,13 @@
# Школьный Telegram-бот столовой (aiogram 2). pymorphy2 0.9 не работает на Python 3.11+
FROM python:3.10-slim
ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY code code
# базы из репозитория — в том /app/db при первом запуске
COPY db /opt/db-seed
COPY docker/entrypoint.sh /entrypoint.sh
VOLUME ["/app/db"]
WORKDIR /app/code
ENTRYPOINT ["sh", "/entrypoint.sh"]

View file

@ -3,6 +3,7 @@
[Русский](README.md) · **English**
[![CI](https://github.com/EDeev/school_menu/actions/workflows/ci.yml/badge.svg)](https://github.com/EDeev/school_menu/actions/workflows/ci.yml)
[![Release](https://img.shields.io/github/v/release/EDeev/school_menu)](https://github.com/EDeev/school_menu/releases)
A school cafeteria Telegram bot: every morning it posts the menu from the school website, takes breakfast,
lunch and snack orders by class and compiles a summary for the cafeteria.
@ -25,6 +26,9 @@ cd code && BOT_TOKEN=token BOT_ID=bot_id TECH_GROUP_ID=group_id python bot.py
Portion weights and calories from Excel are parsed without `eval`: only numbers and `+ - * /` are allowed.
**Docker:** `docker run -d -e BOT_TOKEN=token -e BOT_ID=bot_id -e TECH_GROUP_ID=group_id -v school-menu-db:/app/db ghcr.io/edeev/school_menu`
(same as `git.deev.su/edeev/school_menu`); on first start the databases from the repository are copied into the volume.
## License
School project (2021–2022). The code is open for study; there is no separate license.

View file

@ -3,6 +3,7 @@
**Русский** · [English](README.en.md)
[![CI](https://github.com/EDeev/school_menu/actions/workflows/ci.yml/badge.svg)](https://github.com/EDeev/school_menu/actions/workflows/ci.yml)
[![Release](https://img.shields.io/github/v/release/EDeev/school_menu)](https://github.com/EDeev/school_menu/releases)
Telegram-бот школьной столовой: каждое утро присылает меню с сайта школы, принимает заказы завтраков,
обедов и полдников по классам и собирает сводку для столовой.
@ -25,6 +26,9 @@ cd code && BOT_TOKEN=токен BOT_ID=id_бота TECH_GROUP_ID=id_группы
Граммовка и калорийность из Excel разбираются без `eval`: допускаются только числа и `+ - * /`.
**Docker:** `docker run -d -e BOT_TOKEN=токен -e BOT_ID=id_бота -e TECH_GROUP_ID=id_группы -v school-menu-db:/app/db ghcr.io/edeev/school_menu`
(то же — `git.deev.su/edeev/school_menu`); при первом запуске в том копируются базы из репозитория.
## Лицензия
Школьный проект (2021–2022). Код открыт для изучения, отдельной лицензии нет.

4
docker/entrypoint.sh Normal file
View file

@ -0,0 +1,4 @@
#!/bin/sh
# BOT_TOKEN, BOT_ID, TECH_GROUP_ID — из окружения
cp -n /opt/db-seed/* /app/db/ 2>/dev/null || true
exec python bot.py

View file

@ -22,7 +22,7 @@ charset-normalizer==3.1.0
idna==3.4
urllib3==2.0.3
et-xmlfile==1.1.0
Babel==2.12.1
Babel==2.9.1
multidict==6.0.4
yarl==1.9.2
aiosignal==1.3.1