1
0

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.

docker使ってreactアプリの環境構築してみた(最低限だよ)

Posted at

ディレクトリ構成

AppName
  |-- Dockerfile
  |-- docker-composecompose.yml

docker関連のファイルの記述

Dockerfile
FROM node:17-alpine
WORKDIR /usr/src/app
docker-compose.yml
version: '3.9'

services:
  node:
    build: ./
    volumes:
      - .:/usr/src/app:cached
    command: sh -c "cd react-sample && yarn start"
    ports:
      - "3000:3000"

コマンドの実行

react-sampleは自身に合わせて変更。

docker-compose run --rm node sh -c "npm install -g create-react-app && create-react-app react-sample"
docker compose up

このようになれば完了。

スクリーンショット 2022-03-22 20.02.04.png

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?