fix Docker image: separate static assets from build output

This commit is contained in:
Henning Jacobs
2016-12-21 22:55:15 +01:00
parent 6ae7ee0f46
commit 2a4bf6b0c8
5 changed files with 5 additions and 4 deletions

2
.gitignore vendored
View File

@@ -3,5 +3,5 @@ __pycache__
*.pyc
.idea/
**/node_modules/
static/
static/build/
*-secret

View File

@@ -15,6 +15,7 @@ RUN pip3 install -r /requirements.txt
COPY app.py /
COPY templates /templates
COPY app /app
COPY static /static
WORKDIR /app
RUN npm install && npm run build

2
app.py
View File

@@ -91,7 +91,7 @@ def health():
@authorize
def index():
app_js = None
for entry in os.listdir('static'):
for entry in os.listdir('static/build'):
if entry.startswith('app'):
app_js = entry
break

View File

@@ -4,7 +4,7 @@
"description": "=========================== Kubernetes Operational View ===========================",
"main": "src/app.js",
"config": {
"buildDir": "../static"
"buildDir": "../static/build"
},
"scripts": {
"prestart": "npm install",

View File

@@ -20,7 +20,7 @@
<body>
<!-- make sure the font is loaded -->
<div id="loading" style="font-family: ShareTechMono">Loading..</div>
<script src="static/{{ app_js }}"></script>
<script src="static/build/{{ app_js }}"></script>
<script>document.getElementById('loading').style.display = 'none'; const app = new App(); app.run()</script>
</body>
</html>