Add devcontainer configuration (#62)

This commit is contained in:
Jesse Hills 2022-11-10 21:53:02 +13:00 committed by GitHub
parent 5b38efb502
commit 187ee4b9e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 106 additions and 0 deletions

10
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,10 @@
FROM ghcr.io/home-assistant/devcontainer:addons
RUN \
apt-get update \
&& apt-get install -y --no-install-recommends \
python3-pip
COPY script/requirements.txt /
RUN pip install -r /requirements.txt

View File

@ -0,0 +1,36 @@
{
"name": "ESPHome Home Assistant add-on devcontainer",
"image": "ghcr.io/esphome/devcontainer:addons",
"appPort": [
"7123:8123",
"7357:4357"
],
"postStartCommand": "bash devcontainer_bootstrap",
"runArgs": [
"-e",
"GIT_EDITOR=code --wait",
"--privileged"
],
"containerEnv": {
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
},
"extensions": [
"timonwong.shellcheck",
"esbenp.prettier-vscode"
],
"mounts": [
"type=volume,target=/var/lib/docker"
],
"settings": {
"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
}
}

View File

@ -0,0 +1,41 @@
name: Build devcontainer image
on:
workflow_dispatch:
push:
branches:
- main
paths:
- .devcontainer/**
schedule:
- cron: '0 0 1 * *'
pull_request:
branches:
- main
paths:
- .devcontainer/**
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
- name: Log in to the GitHub container registry
uses: docker/login-action@v2.1.0
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2.1.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.2.1
- name: Build and Push
uses: docker/build-push-action@v3.2.0
with:
context: .
file: .devcontainer/Dockerfile
tags: ghcr.io/${{ github.repository_owner }}/devcontainer:addons
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64

19
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,19 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Start Home Assistant",
"type": "shell",
"command": "supervisor_run",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
}
]
}