Dockerfile for a nuxt module
Does anyone have an example Dockerfile that would work for a repo that contains a nuxt module at its root? I want to build the module, and then expose the .playground.
2 Replies
Hi @dmarr. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
If your repository contains a Nuxt module at its root and you want to build the module and expose the
.playground
(which is a Nuxt app used for development and testing the module), you can use a Dockerfile similar to those used for Nuxt applications, but targeting the .playground
directory for build and runtime.
The knowledge sources do not provide a ready-made Dockerfile specifically for a Nuxt module repo, but based on the official Nuxt module starter and deployment docs, you should:
1. Build the module (usually handled automatically when running the playground).
2. Build the playground Nuxt app.
3. Expose the playground app for development or testing.
Here’s an example Dockerfile adapted from the official Nuxt deployment docs, targeting the .playground
directory:
Notes:
- Adjust for your package manager (pnpm
, yarn
, or npm
) as needed.
- This Dockerfile assumes your module and the .playground
directory are at the repo root, as is standard with the Nuxt module starter template.
- The .playground
directory acts as a Nuxt app and is used for development/testing of your module, as described in the Nuxt Module Author Guide.
- You may need to tweak the Dockerfile if your module or playground has additional dependencies or custom build steps.
For more details on developing and building Nuxt modules with a playground, see the Nuxt Module Author Guide and Deploying with Docker.
If you need to run the playground in development mode (hot reload), you can change the CMD
to run pnpm run dev
instead of node /app/server/index.mjs
.
If you need a different setup, please provide more details about your module structure.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@139883350096740354> Kapa.ai is still learning and improving, please let me know how I did by reacting below.