GitHub user dosubot[bot] added a comment to the discussion: Upon deploying superset on k8s, UI is not being served (/app/superset-frontend directory has only package.json)
<!-- Answer --> The official Superset image uses a multi-stage Docker build: Node.js and npm are only present in the build stages to compile frontend assets, and the final runtime image is slimmed down to exclude them. If you start from apache/superset:4.1.2, you’re inheriting the final image, which means you can’t build or copy in assets at runtime—assets must be built during the image build process, not after. If you see only package.json in /app/superset-frontend, it means the asset build step was skipped or failed during the image build. This can happen if DEV_MODE was set to true, or if you’re layering on top of an image that never had assets built in the first place. The official image should have assets, but if the build failed upstream or you’re using a custom build, you’ll see this issue [reference](https://github.com/apache/superset/blob/93583220a7aa4debeaf3fd4a6cade9f771ee8c2f/Dockerfile). To fix this, you need a multi-stage Dockerfile that builds the frontend assets before producing the final image. Here’s a simplified example based on the official approach: ```dockerfile # Stage 1: Build frontend assets FROM node:20-bookworm-slim as frontend-build WORKDIR /app/superset-frontend COPY superset-frontend/package*.json ./ RUN npm ci COPY superset-frontend/ ./ RUN npm run build # Stage 2: Build final image FROM apache/superset:4.1.2 USER root RUN pip install psycopg2-binary Pillow COPY --from=frontend-build /app/superset-frontend/build /app/superset-frontend/build USER superset CMD ["/app/docker/entrypoints/run-server.sh"] ``` You may need to adjust the paths to match where assets are expected (typically /app/superset/static/assets in the final image). The key is that the build output from the frontend-build stage is copied into the final image before runtime. Make sure you’re using Node.js and npm versions that match what’s in superset-frontend/package.json (Node ^20.16.0, npm ^10.8.1) to avoid build freezes [reference](https://github.com/apache/superset/issues/33050). If you still see missing assets, check that DEV_MODE is not set to true during the build, and monitor the build logs for any npm or webpack errors [reference](https://github.com/apache/superset/issues/32898). Let me know if you want a more detailed example or help troubleshooting a specific build error. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/cd8ca000-162e-4bbf-86d1-25b055b50361?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/cd8ca000-162e-4bbf-86d1-25b055b50361?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/cd8ca000-162e-4bbf-86d1-25b055b50361?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/cd8ca000-162e-4bbf-86d1-25b055b50361?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/cd8ca000-162e-4bbf-86d1-25b055b50361?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/cd8ca000-162e-4bbf-86d1-25b055b50361?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/cd8ca000-162e-4bbf-86d1-25b055b50361?feedback_type=other)</sup> [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/33840) GitHub link: https://github.com/apache/superset/discussions/33840#discussioncomment-13529226 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
