From 1427fad9d521350cc506cb5742f609c0f66dd6fd Mon Sep 17 00:00:00 2001 From: Riccardo Balbo Date: Thu, 25 Jul 2024 20:13:26 +0000 Subject: [PATCH] devcontainer --- .devcontainer/devcontainer.json | 11 +++++++++-- .devcontainer/setup.sh | 7 +++++-- .devcontainer/start.sh | 4 ++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9aae926..7a26cec 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,8 +9,13 @@ }, "mounts": [ "source=${localWorkspaceFolder}/.devcontainer/start.sh,target=/start-lnbits.sh,type=bind", - "source=${localWorkspaceFolder}/.devcontainer/setup.sh,target=/setup.sh,type=bind" + "source=${localWorkspaceFolder}/.devcontainer/setup.sh,target=/setup.sh,type=bind", + "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" + ], + "containerEnv": { + "IS_DEV_CONTAINER": "true", + }, "postCreateCommand": "/bin/bash /setup.sh ${containerWorkspaceFolder}", "postStartCommand": "/bin/bash /start-lnbits.sh", "forwardPorts": [ @@ -22,5 +27,7 @@ "python.pythonPath": "/opt/python/bin/python3.9" } } - } + }, + "runArgs": ["--network", "host"] + } diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index 212efcb..53ad44d 100644 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -2,10 +2,11 @@ CONTAINER_WORKSPACE_FOLDER=$1 sudo apt update -y sudo apt install -y python3.9-distutils curl +sudo apt-get install -y docker.io + curl -fsSL https://deb.nodesource.com/setup_20.x -o /tmp/nodesource_setup.sh sudo bash /tmp/nodesource_setup.sh sudo apt-get install -y nodejs -cd .. if [ ! -d lnbits ] ; then sudo git clone https://github.com/lnbits/lnbits.git; fi @@ -18,6 +19,8 @@ sudo ln -s $VENV_PATH /opt/python make bundle poetry install --no-interaction mkdir -p lnbits/extensions/ -ln -s $CONTAINER_WORKSPACE_FOLDER lnbits/extensions/nwcprovider +if [ ! -d lnbits/extensions/nwcprovider ] ; then + ln -s $CONTAINER_WORKSPACE_FOLDER lnbits/extensions/nwcprovider +fi diff --git a/.devcontainer/start.sh b/.devcontainer/start.sh index 124fd53..85d96ee 100644 --- a/.devcontainer/start.sh +++ b/.devcontainer/start.sh @@ -1,4 +1,4 @@ #!/bin/bash -ln -s $PWD/.devcontainer/.env ../lnbits/.env -cd ../lnbits +ln -s $PWD/.devcontainer/.env ./lnbits/.env +cd ./lnbits poetry run lnbits