mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 01:53:39 +01:00
update docker
This commit is contained in:
parent
16dd661d48
commit
d361c4635c
4 changed files with 16 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,3 +6,4 @@ domains.txt
|
|||
geckodriver.log
|
||||
targets.json
|
||||
*.kdev4
|
||||
.env
|
10
Dockerfile
10
Dockerfile
|
@ -1,6 +1,6 @@
|
|||
FROM python:3.11-bullseye
|
||||
|
||||
COPY config.py /
|
||||
COPY config_docker.py /
|
||||
|
||||
RUN wget -O- https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /usr/share/keyrings/google-chrome.gpg
|
||||
|
||||
|
@ -17,7 +17,9 @@ RUN apt-get install -y \
|
|||
python3-wheel \
|
||||
firefox-esr \
|
||||
google-chrome-stable \
|
||||
espeak
|
||||
espeak \
|
||||
sqlite3 \
|
||||
libsqlite3-dev
|
||||
|
||||
COPY requirements.txt /
|
||||
|
||||
|
@ -25,6 +27,6 @@ RUN pip install -U pip wheel setuptools
|
|||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY ../ /
|
||||
COPY ./ /src
|
||||
|
||||
CMD ["main.py"]
|
||||
CMD ["python3", "/src/main.py"]
|
||||
|
|
|
@ -30,5 +30,5 @@ Jimmy by default runs a tiny API on port 3762. In order to make this accessible,
|
|||
$ docker build -t lcc-bot:latest .
|
||||
...
|
||||
|
||||
$ docker run -d --name lcc-bot -v /path/to/host/dir:/data -p 3762:3762 lcc-bot:latest
|
||||
$ docker run -d --name lcc-bot -v /path/to/host/dir:/data -p 3762:3762 --env-file .env lcc-bot:latest
|
||||
```
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import datetime
|
||||
import sys
|
||||
import uuid
|
||||
from typing import TYPE_CHECKING, Optional, TypeVar
|
||||
from enum import IntEnum, auto
|
||||
|
@ -39,6 +40,12 @@ T_co = TypeVar("T_co", covariant=True)
|
|||
_pth = "/main.db"
|
||||
if Path("/data").exists():
|
||||
_pth = "/data/main.db"
|
||||
try:
|
||||
Path(_pth).touch()
|
||||
except PermissionError as e:
|
||||
print("Failed to create database:", e, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
registry = orm.ModelRegistry(Database("sqlite://" + _pth))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue