Skip to content

Commit

Permalink
Merge pull request #720 from felipecrs/fix-devcontainer
Browse files Browse the repository at this point in the history
Fix devcontainer for latest Frigate and Home Assistant
  • Loading branch information
dermotduffy authored Sep 13, 2024
2 parents 912c5d3 + 74ed5e6 commit 070fbf2
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 78 deletions.
11 changes: 1 addition & 10 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
# syntax=docker/dockerfile:1.2
FROM mcr.microsoft.com/devcontainers/python:1-3.10

FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.10

# Install Docker
ENV DOCKER_BUILDKIT="1"
# https://github.com/microsoft/vscode-dev-containers/commits/main/script-library/docker-debian.sh
ARG DOCKER_SCRIPT_VERSION="364972b0d7d20ee5de40c1084e65f3f1bc6d5951"
RUN bash -c "$(curl -fsSL "https://raw.githubusercontent.com/microsoft/vscode-dev-containers/${DOCKER_SCRIPT_VERSION}/script-library/docker-debian.sh")" \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["/usr/local/share/docker-init.sh"]
CMD ["sleep", "infinity"]
10 changes: 1 addition & 9 deletions .devcontainer/config/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ homeassistant:
longitude: 0
elevation: 0
unit_system: metric
country: US
currency: USD
time_zone: "America/Los_Angeles"
auth_providers:
Expand All @@ -25,12 +26,3 @@ logger:
logs:
custom_components.frigate: debug
homeassistant.components.mqtt: error

downloader:
download_dir: www

panel_iframe:
frigate:
title: "Frigate"
url: "http://localhost:5000"
icon: "mdi:cctv"
92 changes: 50 additions & 42 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"dockerComposeFile": "../docker-compose.yml",
"service": "dev",
"service": "devcontainer",
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
"moby": false
}
},
"workspaceFolder": "${localWorkspaceFolder}",
"shutdownAction": "stopCompose",
"initializeCommand": ".devcontainer/set_dot_env.sh",
"postCreateCommand": ".devcontainer/post_create.sh",
"initializeCommand": [".devcontainer/set_dot_env.sh"],
"postCreateCommand": [".devcontainer/post_create.sh"],
"forwardPorts": ["hass:8123", "frigate:5000"],
"portsAttributes": {
"hass:8123": {
Expand All @@ -16,44 +20,48 @@
"onAutoForward": "silent"
}
},
"extensions": [
"ms-python.python",
"visualstudioexptteam.vscodeintellicode",
"mhutchie.git-graph",
"ms-azuretools.vscode-docker",
"streetsidesoftware.code-spell-checker",
"eamodio.gitlens",
"esbenp.prettier-vscode",
"ms-python.vscode-pylance",
"redhat.vscode-yaml",
"keesschollaart.vscode-home-assistant",
"ms-azuretools.vscode-docker"
],
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"yaml.schemas": {
"http://frigate:5000/api/config/schema": "/frigate.yml"
},
"files.associations": {
"**/config/*configuration.yaml": "home-assistant"
},
"vscode-home-assistant.hostUrl": "http://hass:8123",
"vscode-home-assistant.longLivedAccessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhOTZjZTdhYTg0YzU0ODcxYWZhNTJmYmU4OWFmMjg3OSIsImlhdCI6MTY1NDgwNzk2MiwiZXhwIjoxOTcwMTY3OTYyfQ.0JUxrtqWWj-FwkAujcQCc5aRq9sf5_uR_sCI2eWcmIE",
"[home-assistant]": {
"editor.defaultFormatter": "keesschollaart.vscode-home-assistant"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"visualstudioexptteam.vscodeintellicode",
"mhutchie.git-graph",
"ms-azuretools.vscode-docker",
"streetsidesoftware.code-spell-checker",
"eamodio.gitlens",
"esbenp.prettier-vscode",
"ms-python.vscode-pylance",
"redhat.vscode-yaml",
"keesschollaart.vscode-home-assistant",
"ms-azuretools.vscode-docker"
],
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"yaml.schemas": {
"http://frigate:5000/api/config/schema.json": "/frigate.yml"
},
"files.associations": {
"**/config/*configuration.yaml": "home-assistant"
},
"vscode-home-assistant.hostUrl": "http://hass:8123",
"vscode-home-assistant.longLivedAccessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhOTZjZTdhYTg0YzU0ODcxYWZhNTJmYmU4OWFmMjg3OSIsImlhdCI6MTY1NDgwNzk2MiwiZXhwIjoxOTcwMTY3OTYyfQ.0JUxrtqWWj-FwkAujcQCc5aRq9sf5_uR_sCI2eWcmIE",
"[home-assistant]": {
"editor.defaultFormatter": "keesschollaart.vscode-home-assistant"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
}
}
}
21 changes: 9 additions & 12 deletions .devcontainer/frigate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,23 @@ detectors:
type: cpu
mqtt:
host: mqtt
go2rtc:
streams:
big_buck_bunny:
# yamllint disable-line rule:line-length
- exec:ffmpeg -re -stream_loop -1 -i https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_h264.mov -c copy -rtsp_transport tcp -f rtsp {{output}}
cameras:
big_buck_bunny:
ffmpeg:
inputs:
- path: rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4
- path: rtsp://127.0.0.1:8554/big_buck_bunny
input_args: preset-rtsp-restream-low-latency
roles:
- rtmp
- detect
- record
# yamllint disable-line rule:line-length
input_args: -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1
- audio
output_args:
# yamllint disable-line rule:line-length
record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v libx264 -an
rtmp: -c:v libx264 -an -f flv
detect:
width: 240
height: 160
live:
height: 160
record: preset-record-generic-audio-copy
objects:
track:
- cat
15 changes: 15 additions & 0 deletions .devcontainer/preconfig/.storage/core.config_entries
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@
"unique_id": null,
"disabled_by": null
},
{
"entry_id": "8b281b7667ce4609b26a74ea5e6d7221",
"version": 1,
"domain": "downloader",
"title": "Downloader",
"data": {
"download_dir": "www"
},
"options": {},
"pref_disable_new_entities": false,
"pref_disable_polling": false,
"source": "import",
"unique_id": null,
"disabled_by": null
},
{
"entry_id": "77b4c17dc9f77ba49cea06fb3f517b59",
"version": 1,
Expand Down
13 changes: 13 additions & 0 deletions .devcontainer/preconfig/.storage/lovelace.frigate
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"minor_version": 1,
"key": "lovelace.frigate",
"data": {
"config": {
"strategy": {
"type": "iframe",
"url": "http://localhost:5000"
}
}
}
}
18 changes: 18 additions & 0 deletions .devcontainer/preconfig/.storage/lovelace_dashboards
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": 1,
"minor_version": 1,
"key": "lovelace_dashboards",
"data": {
"items": [
{
"id": "frigate",
"url_path": "frigate",
"icon": "mdi:cctv",
"require_admin": false,
"title": "Frigate",
"show_in_sidebar": true,
"mode": "storage"
}
]
}
}
7 changes: 2 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
---
version: "3"

services:
dev:
devcontainer:
build: .devcontainer
user: vscode
init: true
env_file:
- .env
Expand All @@ -24,7 +21,7 @@ services:
- ./custom_components:/config/custom_components:ro
frigate:
privileged: true
image: "ghcr.io/blakeblackshear/frigate:${FRIGATE_VERSION:-0.12.0-rc1}"
image: "ghcr.io/blakeblackshear/frigate:${FRIGATE_VERSION:-stable}"
restart: unless-stopped
devices:
- /dev/bus/usb:/dev/bus/usb
Expand Down

0 comments on commit 070fbf2

Please sign in to comment.