DEV Community

Richardson
Richardson

Posted on

4 1

Nuxt, Docker, WSL2, VSCode...

Hoje um amigo pediu ajuda para colocar uma aplicação no container (docker). Apenas para desenvolvimento mesmo. Como ele não tinha muito conhecimento de docker e nem de como rodar no windows, fiz um vídeo para ajudá-lo e me ajudar a aprender também.

Resultado foi um docker-compose:

version: "3.8"
services:  
  nuxt-ol:
    environment: 
      - NUXT_HOST=0.0.0.0
      - NUXT_PORT=3000
    image: node:12.21.0-alpine3.12
    container_name: nuxt.ol
    hostname: ol.nuxt
    ports:
      - 3000:3000
    volumes:
      - ./nuxt-ol:/usr/src/nuxt-ol
    working_dir: /usr/src/nuxt-ol
    command: npm run dev
Enter fullscreen mode Exit fullscreen mode

Rolou um Makefile (alguém ainda usa mesmo?!):

#!make

npm-install: ## executa npm install
    docker-compose run --rm nuxt-ol npm install

npm-build:
    docker-compose run --rm nuxt-ol npm run build

nuxt-up: ## iniciar serviço
    docker-compose up -d
Enter fullscreen mode Exit fullscreen mode

GitHub logo richardson-souza / nuxt-ol

nuxt.js + vue.js + vuetify.js

  1. clone repo
  2. make npm-install
  3. make npm-build
  4. make nuxt-up

Referências:

The Intuitive Vue Framework
Overview of Docker Compose
Guia de instalação do Subsistema Windows para Linux para Windows 10
Docker Desktop

Reinvent your career. Join DEV.

It takes one minute and is necessary in the AI era.

Get started

Top comments (0)

Eliminate Context Switching and Maximize Productivity

Pieces.app

Pieces Copilot is your personalized workflow assistant, working alongside your favorite apps. Ask questions about entire repositories, generate contextualized code, save and reuse useful snippets, and streamline your development process.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay