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 (