Skip to content

Commit e44fa7f

Browse files
committed
build: bot.py
1 parent 3323a10 commit e44fa7f

File tree

6 files changed

+239
-49
lines changed

6 files changed

+239
-49
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.dockerignore

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# Common
2+
README.md
3+
Dockerfile
4+
.dockerignore
5+
6+
# git
7+
.git/
8+
.gitignore
9+
.github/
10+
11+
# Byte-compiled / optimized / DLL files
12+
**/__pycache__/
13+
*.py[cod]
14+
*$py.class
15+
16+
# C extensions
17+
*.so
18+
19+
# Distribution / packaging
20+
.Python
21+
build/
22+
develop-eggs/
23+
dist/
24+
downloads/
25+
eggs/
26+
.eggs/
27+
lib/
28+
lib64/
29+
parts/
30+
sdist/
31+
var/
32+
wheels/
33+
share/python-wheels/
34+
*.egg-info/
35+
.installed.cfg
36+
*.egg
37+
MANIFEST
38+
39+
# PyInstaller
40+
# Usually these files are written by a python script from a template
41+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
42+
*.manifest
43+
*.spec
44+
45+
# Installer logs
46+
pip-log.txt
47+
pip-delete-this-directory.txt
48+
49+
# Unit test / coverage reports
50+
htmlcov/
51+
.tox/
52+
.nox/
53+
.coverage
54+
.coverage.*
55+
.cache
56+
nosetests.xml
57+
coverage.xml
58+
*.cover
59+
*.py,cover
60+
.hypothesis/
61+
.pytest_cache/
62+
cover/
63+
64+
# Translations
65+
*.mo
66+
*.pot
67+
68+
# Django stuff:
69+
*.log
70+
local_settings.py
71+
db.sqlite3
72+
db.sqlite3-journal
73+
74+
# Flask stuff:
75+
instance/
76+
.webassets-cache
77+
78+
# Scrapy stuff:
79+
.scrapy
80+
81+
# Sphinx documentation
82+
docs/_build/
83+
84+
# PyBuilder
85+
.pybuilder/
86+
target/
87+
88+
# Jupyter Notebook
89+
.ipynb_checkpoints
90+
91+
# IPython
92+
profile_default/
93+
ipython_config.py
94+
95+
# pyenv
96+
# For a library or package, you might want to ignore these files since the code is
97+
# intended to run in multiple environments; otherwise, check them in:
98+
.python-version
99+
100+
# pipenv
101+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
102+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
103+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
104+
# install all needed dependencies.
105+
#Pipfile.lock
106+
107+
# poetry
108+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
109+
# This is especially recommended for binary packages to ensure reproducibility, and is more
110+
# commonly ignored for libraries.
111+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
112+
#poetry.lock
113+
114+
# pdm
115+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
116+
#pdm.lock
117+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
118+
# in version control.
119+
# https://pdm.fming.dev/#use-with-ide
120+
.pdm-python
121+
122+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
123+
__pypackages__/
124+
125+
# Celery stuff
126+
celerybeat-schedule
127+
celerybeat.pid
128+
129+
# SageMath parsed files
130+
*.sage.py
131+
132+
# Environments
133+
.env
134+
.env.*
135+
.venv
136+
env/
137+
venv/
138+
ENV/
139+
env.bak/
140+
venv.bak/
141+
142+
# Spyder project settings
143+
.spyderproject
144+
.spyproject
145+
146+
# Rope project settings
147+
.ropeproject
148+
149+
# mkdocs documentation
150+
/site
151+
152+
# mypy
153+
.mypy_cache/
154+
.dmypy.json
155+
dmypy.json
156+
157+
# Pyre type checker
158+
.pyre/
159+
160+
# pytype static type analyzer
161+
.pytype/
162+
163+
# Cython debug symbols
164+
cython_debug/
165+
166+
# PyCharm
167+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
168+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
169+
# and can be added to the global gitignore or merged into this file. For a more nuclear
170+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
171+
#.idea/

.env renamed to .env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ SQLALCHEMY_SESSION_OPTIONS='{"expire_on_commit": false}'
66

77
ALCONNA_USE_COMMAND_START=true
88

9-
HTMLRENDER_CONNECT=ws://localhost:3000/chromium/playwright?launch={"args":["--disable-web-security"]}
9+
HTMLRENDER_CONNECT=ws://playwright:53333/chromium/playwright

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
FROM python:slim AS base
22
WORKDIR /app
3-
ENV PATH=.venv/bin:${PATH}
43

54

65
FROM base AS build
@@ -18,4 +17,4 @@ FROM base
1817
COPY --link --from=build /app/.venv/ .venv
1918
COPY --link . .
2019

21-
CMD nb orm upgrade && nb run
20+
CMD [".venv/bin/python", "bot.py"]

bot.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import nonebot
2+
from nonebot.adapters.milky import Adapter as NONEBOT_ADAPTER_MILKYAdapter
3+
4+
nonebot.init()
5+
6+
driver = nonebot.get_driver()
7+
driver.register_adapter(NONEBOT_ADAPTER_MILKYAdapter)
8+
9+
10+
nonebot.load_from_toml("pyproject.toml")
11+
12+
if __name__ == "__main__":
13+
if driver.env == "prod":
14+
from contextlib import suppress
15+
16+
from nonebot_plugin_orm.__main__ import main
17+
18+
with suppress(SystemExit):
19+
main(["upgrade"])
20+
21+
nonebot.run()

0 commit comments

Comments
 (0)