Browse Source

feat: adding config for codespaces

alwerner 2 years ago
parent
commit
f51e0ef35f
4 changed files with 33 additions and 0 deletions
  1. 15 0
      .devcontainer/devcontainer.json
  2. 5 0
      .devcontainer/filewatcher.sh
  3. 12 0
      .devcontainer/postCreateCommand.sh
  4. 1 0
      package.json

+ 15 - 0
.devcontainer/devcontainer.json

@@ -0,0 +1,15 @@
+{
+  "image": "mcr.microsoft.com/vscode/devcontainers/javascript-node",
+  "features": {
+    "ghcr.io/devcontainers/features/docker-in-docker": {
+      "version": "latest",
+      "moby": true
+    }
+  },
+  "extensions": [
+    "ms-azuretools.vscode-docker",
+    "ms-vscode.vscode-typescript-next",
+    "waderyan.gitblame"
+  ],
+  "postCreateCommand": "./.devcontainer/postCreateCommand.sh"
+}

+ 5 - 0
.devcontainer/filewatcher.sh

@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+# We need to change the owner of the files in the app-data folder
+# if this failes we have to change the permission your self
+fswatch --event=Created /workspaces/runtipi/app-data/ | \
+   xargs -l1 sh -c 'echo "$1" && sudo chown node "$1" -R' -- &

+ 12 - 0
.devcontainer/postCreateCommand.sh

@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+echo '{ 
+    "appsRepoUrl": "https://github.com/meienberger/runtipi-appstore.git/"
+}' > state/settings.json
+npm i -g pnpm
+pnpm i
+sudo apt-get update
+sudo apt-get install jq fswatch -y
+mkdir logs
+mkdir data
+sudo chown node logs
+sudo chown node data 

+ 1 - 0
package.json

@@ -17,6 +17,7 @@
     "build:server": "node ./esbuild.js build",
     "build:next": "next build",
     "start:dev": "./scripts/start-dev.sh",
+    "start:dev-container": "./.devcontainer/filewatcher.sh && npm run start:dev",
     "start:rc": "docker-compose -f docker-compose.rc.yml --env-file .env up --build",
     "start:prod": "docker-compose -f docker-compose.test.yml --env-file .env up --build",
     "start:pg": "docker run --name test-db -p 5433:5432 -d --rm -e POSTGRES_PASSWORD=postgres postgres:14",