python app.py --build to generate build-metadata.json

This is now run by the Dockerfile to build this at compile time.
pull/383/head
Simon Willison 2017-10-23 22:53:13 -07:00
rodzic b20d7119e4
commit 606ff9e35e
2 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -2,5 +2,6 @@ FROM python:3
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
RUN python app.py --build
EXPOSE 8006
CMD ["python", "app.py"]

6
app.py
Wyświetl plik

@ -8,6 +8,7 @@ from pathlib import Path
from functools import wraps
import json
import hashlib
import sys
app_root = Path(__file__).parent
@ -191,4 +192,7 @@ def resolve_db_name(db_name, **kwargs):
if __name__ == '__main__':
app.run(host="0.0.0.0", port=8006)
if '--build' in sys.argv:
ensure_build_metadata(True)
else:
app.run(host="0.0.0.0", port=8006)