Giter Site home page Giter Site logo

docker-with-react-submodule's Introduction

概要

  • react ベースのプロジェクトを docker コンテナ内で動かすためのプロジェクト

前提

  • react プロジェクトはサブモジュールとして指定
  • 本番用・開発用ともに、Docker イメージ作成中に npm install をして、 node_modules を生成する
  • 開発用のみ、PC 側の frontVolume のソースを使いながら、コンテナ内に node_modules をバインドする
  • 本番用と開発用で docker-compose.yml のファイルを分ける
    用途 ファイル 備考
    本番用 docker-compose.yml node イメージでビルドをして、 nginx イメージにビルド結果を置く
    開発用 docker-compose.dev.yml サブモジュールのプロジェクトを docker コンテナ内の /src に配置する

コマンド

開発

# コマンド
docker compsoe -f docker-compose.dev.yml up -d

# 起動・終了スクリプト
sh bin/dev.sh

# イメージの削除も含めた起動・終了スクリプト
sh bin/dev_rebuild.sh

本番

# コマンド
docker compsoe up -d

# 起動・終了スクリプト
sh bin/prod.sh

# イメージの削除も含めた起動・終了スクリプト
sh bin/prod_rebuild.sh

注意点

  • イメージ削除、キャッシュ削除はこまめにする
    • docker image rm イメージ名
    • docker builder prune

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.