บทความ

กำลังแสดงโพสต์จาก สิงหาคม, 2023

Deploy React App บน GitHub Page

รูปภาพ
  ติดตั้ง gh-pages npm package ด้วยคำสั่ง npm install gh-pages เพิ่ม homepage property ในไฟล์ package.json "homepage": "https://<username>.github.io/<repository-name>" เพิ่ม predeploy และ deploy ใน script ของไฟล์ package.json "predeploy": "npm run build", "deploy": "gh-pages -d build" Add remote repository ด้วยคำสั่ง git remote add origin https://github.com/<username>/<repository-name>.git Push React app ด้วยคำสั่ง npm run deploy หรือ npm run deploy -- -m "<commit-message>" npm จะทำการ build ไฟล์เก็บไว้ในโฟลเดอร์ build แล้ว deploy ขึ้นไปที่ gh-pages branch หากต้องการเก็บ React app source code ไว้บน GitHub สามารถใช้คำสั่ง git add . git commit -m "<commit-message>" git push origin main React app source code จะถูกเก็บใน main branch build file จะถูกเก็บใน gh-pages branch แหล่งอ้างอิง  https://github.com/gitname/react-gh-pages

Docker Command

รูปภาพ
docker --version ตรวจสอบการติดตั้ง Docker + ตรวจสอบ version docker ps ตรวจสอบ Container ที่ run อยู่ ps (process) docker ps -a  ตรวจสอบ Container ทั้งหมด -a (all) docker run -it --name <container name> -p <user port:container port> <image name:tag> Run container จาก image -it (interactive) และ -p (port) โดยเป็นการ expose user post กับ container port ถ้าเปลี่ยนจาก -it เป็น -d (daemon) จะเป็น background running docker stop <container name> หยุดการ run container ตามชื่อ container docker start <container name> เริ่มการ run container ตามชื่อ container docker exec -it <container name> bash ทำการ SSH เข้าไปใน container ตามชื่อ container exit ออกจาก SSH docker rm <container name> ลบ container ตามชื่อ container โดยต้อง stop container ก่อน docker rm -f <container name> ลบ container ตามชื่อ container แบบบังคับลบ -f (force) docker images ตรวจสอบ image ทั้งหมดที่มีอยู่ docker pull <image name:tag> ดึง image มาจาก Docker hub docker b...