Deploy React on Synology Docker
這篇紀錄一下在Synology NAS的Docker上,要如何建立一個Node.js與React的開發環境。
步驟1 安裝Docker
- 進入「Docker \ 倉庫伺服器」,安裝node
步驟2 安裝node.js
![](https://i0.wp.com/sammystuart.blog/wp-content/uploads/2023/04/13_47_47-Window.jpg?resize=987%2C564&ssl=1)
步驟3 部署node.js
![](https://i0.wp.com/sammystuart.blog/wp-content/uploads/2023/04/13_57_47-Window.jpg?resize=986%2C564&ssl=1)
![](https://i0.wp.com/sammystuart.blog/wp-content/uploads/2023/04/14_00_13-Window.jpg?resize=597%2C550&ssl=1)
![](https://i0.wp.com/sammystuart.blog/wp-content/uploads/2023/04/14_01_06-Window.jpg?resize=599%2C550&ssl=1)
![](https://i0.wp.com/sammystuart.blog/wp-content/uploads/2023/04/14_01_53-Window.jpg?resize=599%2C549&ssl=1)
![](https://i0.wp.com/sammystuart.blog/wp-content/uploads/2023/04/14_02_58-Window.jpg?resize=479%2C497&ssl=1)
![](https://i0.wp.com/sammystuart.blog/wp-content/uploads/2023/04/14_04_28-Window.jpg?resize=597%2C548&ssl=1)
步驟4 安裝相關套件
4.1 透過終端機登入Docker
![](https://i0.wp.com/sammystuart.blog/wp-content/uploads/2023/04/14_05_43-Window.jpg?resize=977%2C708&ssl=1)
4.2 安裝套件與建立專案
安裝套件
//於剛才指定的根目錄下,安裝create-react-app
usr/local/app> npm install create-react-app
建立專案
//建立專案
usr/local/app> create-react-app hello-react-app
//其他
//如果在專案內需要使用redux
usr/local/app> cd hello-react-app
usr/local/app/hello-react-app> npm install redux
usr/local/app/hello-react-app> npm install react-redux
啟動伺服器
usr/local/app/hello-react-app> npm start