Update indexer to write sqlite db to persisted volume

This commit is contained in:
IamTheFij 2018-02-05 17:55:07 -08:00
parent 7595af98f9
commit ebf630df2d
3 changed files with 10 additions and 3 deletions

View File

@ -1,6 +1,9 @@
FROM python:3.6-onbuild FROM python:3.6-onbuild
# ENV FLASK_APP=indexer/app.py RUN mkdir -p /config
VOLUME /config
ENV SQLALCHEMY_DATABASE_URI sqlite:////config/tokens.db
ENV FLASK_DEBUG=1 ENV FLASK_DEBUG=1
EXPOSE 5000 EXPOSE 5000

View File

@ -2,6 +2,8 @@ version: '2'
services: services:
main: main:
build: . build: .
environment:
SQLALCHEMY_DATABASE_URI: sqlite:///tokens.db
volumes: volumes:
- .:/usr/src/app - .:/usr/src/app
ports: ports:

View File

@ -9,8 +9,10 @@ import flask
app = flask.Flask(__name__) app = flask.Flask(__name__)
# TODO: use a real database or something app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get(
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URI', 'sqlite:///tokens.db') 'DATABASE_URI',
'sqlite:///tokens.db'
)
app.config['SQLALCHEMY_ECHO'] = True app.config['SQLALCHEMY_ECHO'] = True
app.config['DEBUG'] = True app.config['DEBUG'] = True