Move to app folder and add Dockerfile

This commit is contained in:
James Jennett-Wheeler 2025-06-23 11:17:22 +01:00
parent 1f59cfecd3
commit 69cf48b7c3
9 changed files with 21 additions and 6 deletions

11
Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM infologistix/docker-selenium-python:alpine
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY app/ ./
COPY database.db ./
CMD "python monitor-planning.py"

View File

@ -29,7 +29,7 @@ def notify(title, message):
def update_other_applications():
there_were_newly_decided_applications = False
with sqlite3.connect("database.db") as _conn:
with sqlite3.connect("../database.db") as _conn:
_cursor = _conn.cursor()
with webdriver.Chrome(options=web_opts) as _browser:
@ -64,13 +64,13 @@ def update_other_applications():
if __name__ == '__main__':
try:
with sqlite3.connect("database.db") as connection:
with sqlite3.connect("../database.db") as connection:
cursor = connection.cursor()
Application.CreateTableIfNotExists(cursor, reset_table)
midday_checked = False
while True:
with sqlite3.connect("database.db") as connection:
with sqlite3.connect("../database.db") as connection:
application = Application(connection.cursor(), "25/00605/FUL")
with webdriver.Chrome(options=web_opts) as browser:

View File

@ -17,7 +17,7 @@ api_url = 'https://hass.jennett-wheeler.co.uk/api/webhook/-Qx6jHsGLHwbBlJpLek5Nj
if __name__ == '__main__':
try:
with sqlite3.connect("database.db") as connection:
with sqlite3.connect("../database.db") as connection:
cursor = connection.cursor()
options = webdriver.ChromeOptions()

View File

@ -16,7 +16,7 @@ TAG_RE = re.compile(r'<[^>]+>')
if __name__ == '__main__':
try:
with sqlite3.connect("database.db") as connection:
with sqlite3.connect("../database.db") as connection:
cursor = connection.cursor()
Application.CreateTableIfNotExists(cursor, reset_table)

View File

@ -2,7 +2,7 @@ from application import Application
import sqlite3
with sqlite3.connect("database.db") as connection:
with sqlite3.connect("../database.db") as connection:
cursor = connection.cursor()
applications = []

4
requirements.txt Normal file
View File

@ -0,0 +1,4 @@
pause
prettytable
requests
selenium