LoginSignup
18
18

More than 5 years have passed since last update.

Nuxt.jsの動作環境をdockerで作る

Posted at

はじめに

Nuxt.jsを試すために環境を用意する。
まずはstarter-templateを表示してみる。

環境

Windows10 Pro
Docker for Windows

コンテナ起動準備

node.js公式のイメージからvue-cliだけ入れたイメージを作る。

Dockerfile
FROM node:10-alpine
RUN npm install -g vue-cli
WORKDIR /app
ENV HOST 0.0.0.0
EXPOSE 3000
docker-compose.yml
version: '3'
services:
  app:
    build: .
    tty: true
    volumes:
      - "./../app:/app"
    ports:
      - "3000:3000"

ビルドとコンテナ起動

$ docker-compose build
$ docker-compose up -d

starter-templateの起動

$ docker-compose exec app sh
# vue init nuxt-community/starter-template
# yarn install
# yarn run dev

ブラウザからアクセス

http://localhost:3000

スターターページが表示されればOK。

18
18
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
18