feat(codespaces): .devcontainer + auto-setup & auto-run (Step 10) + rapikan README
This commit is contained in:
1 parent
996b738c4e
commit
4c7a046efe
4 files changed
+54
-2
No files matched your search
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "OPEN-ISP",
|
||||
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/github-cli:1": {}
|
||||
},
|
||||
"forwardPorts": [3001],
|
||||
"portsAttributes": {
|
||||
"3001": { "label": "OPEN-ISP", "onAutoForward": "openPreview" }
|
||||
},
|
||||
"postCreateCommand": "bash .devcontainer/setup.sh",
|
||||
"postStartCommand": "bash .devcontainer/start.sh",
|
||||
"customizations": {
|
||||
"vscode": { "extensions": ["dbaeumer.vscode-eslint"] }
|
||||
},
|
||||
"remoteUser": "node"
|
||||
}
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Setup otomatis OPEN-ISP di GitHub Codespaces
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
echo "==> [OPEN-ISP] Menyiapkan dependensi sistem…"
|
||||
sudo apt-get update -qq && sudo apt-get install -y -qq build-essential python3 >/dev/null 2>&1 || true
|
||||
|
||||
echo "==> [OPEN-ISP] Install dependensi npm…"
|
||||
npm ci --omit=dev || npm install --omit=dev
|
||||
|
||||
echo "==> [OPEN-ISP] Siapkan file .env…"
|
||||
[ -f .env ] || cp env-example.txt .env
|
||||
|
||||
echo "==> [OPEN-ISP] Siapkan data demo…"
|
||||
node scripts/seed-demo.js || true
|
||||
|
||||
echo "==> [OPEN-ISP] Selesai. Aplikasi akan dijalankan otomatis di port 3001."
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# Jalankan OPEN-ISP otomatis saat Codespace aktif
|
||||
cd "$(dirname "$0")/.."
|
||||
if pgrep -f "node app-customer.js" >/dev/null 2>&1; then
|
||||
echo "==> [OPEN-ISP] Aplikasi sudah berjalan."
|
||||
exit 0
|
||||
fi
|
||||
echo "==> [OPEN-ISP] Menjalankan aplikasi di background (port 3001)…"
|
||||
nohup node app-customer.js > /tmp/open-isp.log 2>&1 &
|
||||
sleep 3
|
||||
echo "==> [OPEN-ISP] Log: /tmp/open-isp.log"
|
||||
Reference in new issue
Block a user