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.
This commit is contained in:
parent
0643f781a6
commit
3a8f8f740c
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user