Prepare the base image

Build the image using the Dockerfile.

FROM node:14.15.2-alpine3.12

RUN apk update && apk upgrade \
  && apk add --no-cache bash

WORKDIR /home

# bash is needed for Nuxt's interactive set up.

If the filename is lm-node-alpine, the command will be like that:

docker build --tag lm-node . -f lm-node-alpine

lm-node will be the name of image.

Run on docker-compose

docker-compose.yml is like the below:

version: '3.8'
services:
  web:
    image: lm-node:latest
    command: yarn dev
    volumes:
      - ./:/home
    ports:
      - "3000:3000"

Then run the following command.

docker-compose run web bash  
yarn create nuxt-app mynuxt
(choose options)

Modify package.json(in mynuxt folder) to accept http requests from host machine.

"dev": "HOST=0.0.0.0 nuxt",

You’ll see the start page on your browser.

http://localhost:3000

It looks slower compare to running on homebrew environment.