Recently I had to create a deployment of a NuxtJS application which is running in SSR mode. I have a separate backend that is already packed in Doc...
For further actions, you may consider blocking this person and/or reporting abuse
How about experiment with something like
This should further decrease image bloat because
node_modules
will be created and deleted as part of a single layer creation "function".Thanks for a suggestion, sounds pretty interesting. Need to try it out.
I'm using self-hosted agents for CI, so they keep docker cache between the builds. This way I'm able to skip
yarn install
part cause it's available in cache. Anyway I'll try your suggestion on the same codebase for clarity and report back soon!@artalus please check 🙂
My initial concern was about "why even have node_modules in final docker image at all", and I actually was hoping for 100Mb decrease. But couple of minutes after posting the suggestion I actually realized that, well,
nuxt-start
is a Node application itself, and it will likely require a lot of dependencies to work - because that's just the reality of Node applications ¯\_(ツ)_/¯. So the only gain would be due to removal of a slice ofnode_modules
content that is required byyarn build
but not bynuxt-start
. But small gain is still a gain 🙃Nice post!
It's great if Alpine works for your app and your environment. There's a lot of gotchas with it though and many people that initially adopt it migraine away from it eventually.
For some containerized apps DockerSlim is a good option. It lets you use regular and developer friendly base images minifying the images as a post-processing step. We have nuxt SSR apps too and I'll be happy to share our setup :)
Hey Kyle I'd be very interested to see your setup!
Does this work for nuxt PWA or am I missing something? Getting this error: FATAL Cannot find module '@nuxtjs/pwa' Require stack: /app/node_modules/@nuxt/core/dist/core.js
Same here with strapi module:
Error: Cannot find module '@nuxtjs/strapi'
Require stack: │
│ - /app/node_modules/nuxt-start/node_modules/@nuxt/core/dist/core.js │
same here while deploying on azure
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"lint:js": "eslint --ext .js,.vue --ignore-path .gitignore .",
"lint": "npm run lint:js"
},
"dependencies": {
"nuxt": "^2.15.8",
},
"devDependencies": {
"@nuxtjs/pwa": "^3.3.4",
"webpack": "^4.46.0"
}
try to add in buildModules instead of "module" in nuxt.config
Fixed:
adding the "@nuxtjs/pwa" in buildModules in case of SSR: true (default settings) , and remove "@nuxtjs/pwa" from modules
Hi, i've got an issue with axios when starting the server:
It's the first modules loaded in my nuxt.config.ts
Am i missing something ?
I hit an error with
bootstrap-vue
trying this on my project and didn't want to troubleshoot why that didn't get bundled into the standalone build, but overall this is great :)Great article thanks