GitHub user dosubot[bot] added a comment to the discussion: How to create a visualization plugin in superset 6.0.0 using docker
<!-- Answer --> To deploy your visualization plugin in a production Superset instance using Docker, you need to build a custom Docker image that extends the stock Superset image and includes your plugin in the frontend build. The stock image does not include custom plugins by default. Here’s the typical workflow ([source](https://github.com/apache/superset/pull/36028), [source](https://github.com/apache/superset/blob/master/docs/docs/installation/docker-builds.mdx)): 1. **Publish your plugin to npm** (recommended for simplicity), or copy your plugin source into the build context if it’s local-only. 2. **Install your plugin in the frontend**: In your Dockerfile or build script, run `npm i <your_chart_package>` inside `superset-frontend`. 3. **Register your plugin**: Import and add your plugin to the plugins array in `superset-frontend/src/visualizations/presets/MainPreset.js`. 4. **Build your custom image**: From the Superset repo root, run: ```bash docker build -t apache/superset:mychart --target lean . ``` This compiles your plugin into the frontend assets. 5. **Deploy using your custom image**: In your production Docker setup, use `FROM apache/superset:mychart` in your Dockerfile or reference the new image tag in your deployment. If your plugin isn’t published to npm, you’ll need to copy its source code into the container during the build ([details](https://github.com/apache/superset/pull/36028)). If you hit npm version errors, run `npm install` inside a node container matching the Dockerfile’s node version ([details](https://github.com/apache/superset/pull/36028)). For advanced use cases (like dynamic plugins or extensions), you can package your plugin as a `.supx` extension and upload it via the Superset API ([details](https://github.com/apache/superset/issues/34162)). Let me know if you want a concrete Dockerfile example or more details on any step! <!-- 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/962b6e84-b181-443a-9d33-f9d8f0a3c0f0?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/962b6e84-b181-443a-9d33-f9d8f0a3c0f0?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/962b6e84-b181-443a-9d33-f9d8f0a3c0f0?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/962b6e84-b181-443a-9d33-f9d8f0a3c0f0?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/962b6e84-b181-443a-9d33-f9d8f0a3c0f0?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/962b6e84-b181-443a-9d33-f9d8f0a3c0f0?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/962b6e84-b181-443a-9d33-f9d8f0a3c0f0?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=To%20deploy%20your%20visualization%20plugin%20in%20a%20production%20Superset%20instance%20using%20Docker%2C%20you%20need%20to%20build%20a%20custom%20Docker%20image%20that%20extends%20the%20stock%20Superset%20image%20and%20includes%20your%20plugin%20in%20the%20frontend%20build.%20The%20stock%20image%20does%20not%20include%20custom%20plugins%20by%20default.%0A%0AHere%E2%80%99s%20the%20typical%20workflow%20%28%5Bsource%5D%28https%3A//github.com/apache/superset/pull/36028%29%2C%20%5Bsource%5D%28https%3A//github.com/apache/superset/blob/master/docs/docs/installation/docker-builds.mdx%29%29%3A%0A%0A1.%20%2A%2APublish%20your%20plugin%20to%20npm%2A%2A%20%28recommended%20for%20simplicity%29%2C%20or%20copy%20your%20plugin%20source%20into%20the%20build%20context %20if%20it%E2%80%99s%20local-only.%0A2.%20%2A%2AInstall%20your%20plugin%20in%20the%20frontend%2A%2A%3A%20%20%0A%20%20%20In%20your%20Dockerfile%20or%20build%20script%2C%20run%20%60npm%20i%20%3Cyour_chart_package%3E%60%20inside%20%60superset-frontend%60.%0A3.%20%2A%2ARegister%20your%20plugin%2A%2A%3A%20%20%0A%20%20%20Import%20and%20add%20your%20plugin%20to%20the%20plugins%20array%20in%20%60superset-frontend/src/visualizations/presets/MainPreset.js%60.%0A4.%20%2A%2ABuild%20your%20custom%20image%2A%2A%3A%20%20%0A%20%20%20From%20the%20Superset%20repo%20root%2C%20run%3A%0A%20%20%20%60%60%60bash%0A%20%20%20docker%20build%20-t%20apache/superset%3Amychart%20--target%20lean%20.%0A%20%20%20%60%60%60%0A%20%20%20This%20compiles%20your%20plugin%20into%20the%20frontend%20assets.%0A5.%20%2A%2ADeploy%20using%20your%20custom%20image%2A%2A%3A%20%20%0A%20%20%20In%20your%20production%20Docker%20setup%2C%20use%20%60FROM%20apache/superset%3Amychart%60%20in%20your%20Dockerfile%20or%20reference%20the%20new% 20image%20tag%20in%20your%20deployment.%0A%0AIf%20your%20plugin%20isn%E2%80%99t%20published%20to%20npm%2C%20you%E2%80%99ll%20need%20to%20copy%20its%20source%20code%20into%20the%20container%20during%20the%20build%20%28%5Bdetails%5D%28https%3A//github.com/apache/superset/pull/36028%29%29.%20If%20you%20hit%20npm%20version%20errors%2C%20run%20%60npm%20install%60%20inside%20a%20node%20container%20matching%20the%20Dockerfile%E2%80%99s%20node%20version%20%28%5Bdetails%5D%28https%3A//github.com/apache/superset/pull/36028%29%29.%0A%0AFor%20advanced%20use%20cases%20%28like%20dynamic%20plugins%20or%20extensions%29%2C%20you%20can%20package%20your%20plugin%20as%20a%20%60.supx%60%20extension%20and%20upload%20it%20via%20the%20Superset%20API%20%28%5Bdetails%5D%28https%3A//github.com/apache/superset/issues/34162%29%29.%0A%0ALet%20me%20know%20if%20you%20want%20a%20concrete%20Dockerfile%20example%20or%20more%20details%20on%20any%20step%21) [](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/37031) GitHub link: https://github.com/apache/superset/discussions/37031#discussioncomment-15464237 ---- 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]
