I would like to write an add-on that runs a mail server. I was able to follow the tutorial as well as the devcontainer template method. I am struggling though because all of these containers and remote machines are very confusing. I mostly understand the devcontainer method but the way it works seems super inefficient. Every time I open VS Code and connect to the dev container I have to “Start Home Assistant” again. That would be fine except it’s a fresh install every time! I have to do the onboarding steps and install the add-on every time I open VS Code. I keep re-opening VS Code because I’m trying to find a “quick” way to listen to additional ports which brings me to…
Ports. The tutorial example runs a web server on 8000. When I ran that in a devcontainer I couldn’t connect unless I added it to appPort in devcontainer.json. Of course this requires an entire rebuild of the dev container to change (which also means a rebuild of HA). Why does port forwarding require a rebuild? I’m not a docker expert but forwarded ports are specified in the RUN command.
I feel like I’m missing something. Is there a way to just spin up HA in a container, letting it run 24/7. Then connect to that existing container from VS code and edit the addon directory? This method seems way more efficient and makes more sense to me.
PS - The tutorial uses Samba to edit the addon files, I would be fine with this method except I could not get Git to work correctly on the network share. Wondering what the benefits of devcontainer are over editing files in Samba share. It seems like a lot of headache just to make Git work.