Replace devcontainer (#2209)

This commit is contained in:
Joakim Sørensen
2021-10-21 13:56:23 +02:00
committed by GitHub
parent 97c926e640
commit 9ba546a0f6
3 changed files with 40 additions and 93 deletions

View File

@@ -1,46 +0,0 @@
FROM mcr.microsoft.com/vscode/devcontainers/base:debian
WORKDIR /workspaces
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Set Docker daemon config
RUN \
mkdir -p /etc/docker \
&& echo '{"storage-driver": "vfs"}' > /etc/docker/daemon.json
# Installa aditional tools
RUN \
apt-get update \
&& apt-get install -y --no-install-recommends \
dbus \
network-manager \
libpulse0 \
xz-utils
# Install docker
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
software-properties-common \
gpg-agent \
&& curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - \
&& add-apt-repository "deb https://download.docker.com/linux/debian $(lsb_release -cs) stable" \
&& apt-get update && apt-get install -y --no-install-recommends \
docker-ce \
docker-ce-cli \
containerd.io \
&& rm -rf /var/lib/apt/lists/*
# Install shellcheck
RUN \
curl -fLs \
"https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" \
| tar -xJ \
\
&& mv -f "./shellcheck-stable/shellcheck" "/usr/bin/shellcheck" \
&& rm -rf "./shellcheck-stable"
# Generate a machine-id for this container
RUN rm /etc/machine-id && dbus-uuidgen --ensure=/etc/machine-id

View File

@@ -1,18 +1,23 @@
{ {
"name": "Home Assistant Add-Ons", "name": "Home Assistant Add-ons",
"context": "..", "image": "ghcr.io/home-assistant/devcontainer:addons",
"dockerFile": "Dockerfile",
"appPort": ["7123:8123", "7357:4357"], "appPort": ["7123:8123", "7357:4357"],
"postStartCommand": "service docker start", "postStartCommand": "bash devcontainer_bootstrap",
"runArgs": ["-e", "GIT_EDITOR=code --wait", "--privileged"], "runArgs": ["-e", "GIT_EDITOR=code --wait", "--privileged"],
"containerEnv": { "containerEnv": {
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}" "WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
}, },
"extensions": [ "extensions": ["timonwong.shellcheck", "esbenp.prettier-vscode"],
"timonwong.shellcheck",
"esbenp.prettier-vscode"
],
"settings": { "settings": {
"terminal.integrated.shell.linux": "/bin/bash" "terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
}
},
"terminal.integrated.defaultProfile.linux": "zsh",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
} }
} }

16
.vscode/tasks.json vendored
View File

@@ -1,31 +1,19 @@
{ {
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"label": "Start Home Assistant", "label": "Start Home Assistant",
"type": "shell", "type": "shell",
"command": "./.devcontainer/supervisor.sh", "command": "supervisor_run",
"group": { "group": {
"kind": "test", "kind": "test",
"isDefault": true, "isDefault": true
}, },
"presentation": { "presentation": {
"reveal": "always", "reveal": "always",
"panel": "new" "panel": "new"
}, },
"problemMatcher": [] "problemMatcher": []
},{
"label": "Run Home Assistant CLI",
"type": "shell",
"command": "docker exec -ti hassio_cli /usr/bin/cli.sh",
"group": "test",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
} }
] ]
} }