devcontainer

This commit is contained in:
Riccardo Balbo 2024-07-25 20:13:26 +00:00
commit 1427fad9d5
3 changed files with 16 additions and 6 deletions

View file

@ -9,8 +9,13 @@
}, },
"mounts": [ "mounts": [
"source=${localWorkspaceFolder}/.devcontainer/start.sh,target=/start-lnbits.sh,type=bind", "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}", "postCreateCommand": "/bin/bash /setup.sh ${containerWorkspaceFolder}",
"postStartCommand": "/bin/bash /start-lnbits.sh", "postStartCommand": "/bin/bash /start-lnbits.sh",
"forwardPorts": [ "forwardPorts": [
@ -22,5 +27,7 @@
"python.pythonPath": "/opt/python/bin/python3.9" "python.pythonPath": "/opt/python/bin/python3.9"
} }
} }
} },
"runArgs": ["--network", "host"]
} }

View file

@ -2,10 +2,11 @@
CONTAINER_WORKSPACE_FOLDER=$1 CONTAINER_WORKSPACE_FOLDER=$1
sudo apt update -y sudo apt update -y
sudo apt install -y python3.9-distutils curl 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 curl -fsSL https://deb.nodesource.com/setup_20.x -o /tmp/nodesource_setup.sh
sudo bash /tmp/nodesource_setup.sh sudo bash /tmp/nodesource_setup.sh
sudo apt-get install -y nodejs sudo apt-get install -y nodejs
cd ..
if [ ! -d lnbits ] ; then if [ ! -d lnbits ] ; then
sudo git clone https://github.com/lnbits/lnbits.git; sudo git clone https://github.com/lnbits/lnbits.git;
fi fi
@ -18,6 +19,8 @@ sudo ln -s $VENV_PATH /opt/python
make bundle make bundle
poetry install --no-interaction poetry install --no-interaction
mkdir -p lnbits/extensions/ 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

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
ln -s $PWD/.devcontainer/.env ../lnbits/.env ln -s $PWD/.devcontainer/.env ./lnbits/.env
cd ../lnbits cd ./lnbits
poetry run lnbits poetry run lnbits