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

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay