From 21989f00cdbca1d9fe775e17dab3f71402bbca32 Mon Sep 17 00:00:00 2001 From: Tim Staat Date: Wed, 20 May 2026 17:45:52 +0200 Subject: [PATCH] Fixed Dockerfile There is now a /data directory that contains the location.db, both belonging to user app. This fixed permission issues and ensures that the app does not try to write in a ro docker layer. --- Dockerfile | 7 +++++-- server/python_server.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 408aa63..00cee71 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,10 +5,13 @@ WORKDIR /usr/local/app COPY server/requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt -COPY server/python_server.py +COPY server/python_server.py ./python_server.py + EXPOSE 8080 -RUN useradd app +RUN useradd app && mkdir /data && touch /data/location.db && chown -R app /dataa +VOLUME /data + USER app CMD ["gunicorn", "-w", "4", "python_server:app", "--bind", "0.0.0.0:8080"] diff --git a/server/python_server.py b/server/python_server.py index ddc35ab..f6a1dc6 100644 --- a/server/python_server.py +++ b/server/python_server.py @@ -9,7 +9,7 @@ app = Flask(__name__) bear_correction = False -with sqlite3.connect('location.db', check_same_thread=False) as conn: +with sqlite3.connect('/data/location.db', check_same_thread=False) as conn: cur = conn.cursor() cur.execute("""CREATE TABLE IF NOT EXISTS location_data (