Modernize dev environment

This commit is contained in:
Thomas Lovén 2021-04-29 10:19:34 +00:00
parent 862b93a175
commit 11dc0de087
3 changed files with 57 additions and 65 deletions

View File

@ -0,0 +1,40 @@
{
"name": "hass-browser_mod Dev",
"image": "thomasloven/hass-custom-devcontainer",
"postCreateCommand": "sudo -E container setup-dev && npm add",
"containerEnv": {
"DEVCONTAINER": "1"
},
"forwardPorts": [8123],
"mounts": [
"source=${localWorkspaceFolder},target=/config/www/workspace,type=bind",
"source=${localWorkspaceFolder}/test,target=/config/test,type=bind",
"source=${localWorkspaceFolder}/test/configuration.yaml,target=/config/configuration.yaml,type=bind",
"source=${localWorkspaceFolder}/custom_components,target=/config/custom_components,type=bind"
],
"runArgs": ["--env-file", "${localWorkspaceFolder}/test/.env"],
"extensions": [
"github.vscode-pull-request-github",
"esbenp.prettier-vscode",
"spmeesseman.vscode-taskexplorer",
"ms-python.python"
],
"settings": {
"files.eol": "\n",
"editor.tabSize": 2,
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"files.trimTrailingWhitespace": true,
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.formatting.provider": "black"
}
}

View File

@ -11,17 +11,13 @@ browser_mod:
fully:
force_stay_awake: true
lovelace:
mode: yaml
resources:
- url: /local/card-mod.js
type: module
mode: storage
dashboards:
lovelace-yaml:
mode: yaml
title: yaml
filename: lovelace.yaml
filename: test/lovelace.yaml
frontend:
themes:
@ -37,7 +33,7 @@ frontend:
tts:
- platform: google_translate
base_url: !env_var OUT_ADDR
# base_url: !env_var OUT_ADDR
script:
cm_debug:

View File

@ -1,61 +1,17 @@
#
# Docker services for testing Home Assistant integrations and plugins
#
# Automaatically sets up configuration adds a user and skips the onboarding
#
# Username: dev
# Password: dev
#
# Two services, 'prod' and 'dev' run the latest production and dev docker images respectively.
#
# Start with
# $ docker-compose up prod
# or
# $ docker-compose up dev
#
# When done, clean up with
# $ docker-compose rm -f
#
version: "3.0"
x-files: &x-files
- ../custom_components:/config/custom_components
- ./configuration.yaml:/config/configuration.yaml
- ./lovelace.yaml:/config/lovelace.yaml
- ./views:/config/views
x-command: &x-command |
bash -c '
mkdir /config/www/
curl https://raw.githubusercontent.com/thomasloven/lovelace-card-mod/master/card-mod.js --output /config/www/card-mod.js &&
hass --script ensure_config -c /config &&
hass --script auth -c /config add dev dev &&
echo "
{
\"data\": {
\"done\": [
\"user\",
\"core_config\",
\"integration\"
]
},
\"key\": \"onboarding\",
\"version\": 3
}
" > /config/.storage/onboarding &&
hass -v -c /config'
version: '3.5'
services:
prod: &base_service
image: homeassistant/home-assistant:latest
volumes: *x-files
ports:
- "5001:8123"
test:
image: thomasloven/hass-custom-devcontainer
environment:
OUT_ADDR: "http://${DOCKER_GATEWAY_HOST:-localhost}:5001"
command: *x-command
dev:
<<: *base_service
image: homeassistant/home-assistant:dev
- HASS_USERNAME
- HASS_PASSWORD
- LOVELACE_LOCAL_FILES
- LOVELACE_PLUGINS
volumes:
- ./configuration.yaml:/config/configuration.yaml:ro
- .:/config/test:ro
- ..:/config/www/workspace
- ../custom_components:/config/custom_components
ports:
- 8125:8123