fix Docker image: separate static assets from build output
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,5 +3,5 @@ __pycache__
|
||||
*.pyc
|
||||
.idea/
|
||||
**/node_modules/
|
||||
static/
|
||||
static/build/
|
||||
*-secret
|
||||
|
||||
@@ -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
2
app.py
@@ -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
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "=========================== Kubernetes Operational View ===========================",
|
||||
"main": "src/app.js",
|
||||
"config": {
|
||||
"buildDir": "../static"
|
||||
"buildDir": "../static/build"
|
||||
},
|
||||
"scripts": {
|
||||
"prestart": "npm install",
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user