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 *.pyc
.idea/ .idea/
**/node_modules/ **/node_modules/
static/ static/build/
*-secret *-secret

View File

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

2
app.py
View File

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

View File

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

View File

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