diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..d5ec82da --- /dev/null +++ b/.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" +} \ No newline at end of file diff --git a/.devcontainer/filewatcher.sh b/.devcontainer/filewatcher.sh new file mode 100755 index 00000000..febec219 --- /dev/null +++ b/.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' -- & \ No newline at end of file diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh new file mode 100755 index 00000000..a4972005 --- /dev/null +++ b/.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 diff --git a/package.json b/package.json index 08c441af..56ac301a 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "act:test-install": "act --container-architecture linux/amd64 -j test-install", "act:docker": "act --container-architecture linux/amd64 --secret-file github.secrets -j build-images", "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", @@ -36,4 +37,4 @@ "path": "@commitlint/cz-commitlint" } } -} +} \ No newline at end of file