1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Next.jsの環境構築をDockerで

Last updated at Posted at 2022-09-30
touch Dockerfile docker-compose.yml
FROM node:18-alpine
RUN mkdir /var/www
WORKDIR /var/www
docker-compose.yml
version: '3.9'
services:
  web:
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - .:/var/www # ローカルをコンテナ内にマウント
    command: sh -c "cd ./src && npm run dev"
    ports:
      - "3000:3000"
    stdin_open: true 
docker-compose build 
docker-compose run web npx create-next-app@latest src --typescript

yでエンター 

srcディレクトリが生成され、その中にいろいろ作られる

docker-compose up -d

localhost:3000にアクセスで初期画面表示

1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?