Updated docker file to run new script file
This commit is contained in:
parent
59d379f657
commit
ef94773b8f
2
app.py
2
app.py
@ -15,7 +15,7 @@ def main():
|
|||||||
if secret_key == None:
|
if secret_key == None:
|
||||||
# NO Secret Key set!
|
# NO Secret Key set!
|
||||||
print("No app secret set, please set one before deploying in production")
|
print("No app secret set, please set one before deploying in production")
|
||||||
app.secret_key = "DEFUALTKEY"
|
app.secret_key = "DEFAULTKEY"
|
||||||
else:
|
else:
|
||||||
app.secret_key = secret_key
|
app.secret_key = secret_key
|
||||||
|
|
||||||
|
@ -4,7 +4,11 @@ services:
|
|||||||
wmgzon:
|
wmgzon:
|
||||||
container_name: "wmgzon"
|
container_name: "wmgzon"
|
||||||
build: .
|
build: .
|
||||||
|
environment:
|
||||||
|
- APPSECRET=test
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "5000:5000"
|
||||||
volumes:
|
volumes:
|
||||||
- .:/code
|
- .:/app
|
||||||
|
restart: unless-stopped
|
||||||
|
|
@ -3,6 +3,4 @@ COPY ./requirements.txt /app/requirements.txt
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
COPY . /app
|
COPY . /app
|
||||||
ENTRYPOINT [ "python" ]
|
CMD ["scripts/run.sh"]
|
||||||
RUN ["scripts/create_database.py"]
|
|
||||||
CMD ["app.py" ]
|
|
@ -6,13 +6,15 @@ def create_connection(db_file):
|
|||||||
""" create a database connection to a SQLite database """
|
""" create a database connection to a SQLite database """
|
||||||
conn = None
|
conn = None
|
||||||
try:
|
try:
|
||||||
|
print("Opening Database file and ensuring table integrity")
|
||||||
conn = sqlite3.connect(db_file)
|
conn = sqlite3.connect(db_file)
|
||||||
|
|
||||||
# Execute creation scripts
|
# Execute creation scripts
|
||||||
sql = open("scripts/create_tables.sql", "r");
|
sql = open("scripts/create_tables.sql", "r");
|
||||||
conn.executescript(sql.read())
|
conn.executescript(sql.read())
|
||||||
|
|
||||||
print(sqlite3.version)
|
print("SQLite Version: " + sqlite3.version)
|
||||||
|
print("Table creation complete")
|
||||||
except Error as e:
|
except Error as e:
|
||||||
print(e)
|
print(e)
|
||||||
finally:
|
finally:
|
||||||
|
4
scripts/run.sh
Normal file
4
scripts/run.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
python ./scripts/create_database.py
|
||||||
|
python ./app.py
|
Loading…
Reference in New Issue
Block a user