update docker

This commit is contained in:
Nexus 2023-03-20 16:59:46 +00:00
parent 16dd661d48
commit d361c4635c
Signed by: nex
GPG key ID: 0FA334385D0B689F
4 changed files with 16 additions and 6 deletions

3
.gitignore vendored
View file

@ -5,4 +5,5 @@ venv
domains.txt
geckodriver.log
targets.json
*.kdev4
*.kdev4
.env

View file

@ -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"]

View file

@ -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
```

View file

@ -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))