Skip to content

Add go2rtc-beta Home Assistant addon#33

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/add-go2rtc-beta-addon
Draft

Add go2rtc-beta Home Assistant addon#33
Copilot wants to merge 2 commits into
mainfrom
copilot/add-go2rtc-beta-addon

Conversation

Copilot AI commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Adds a new go2rtc-beta addon built from the beta branch of skrashevich/go2rtc, mirroring the double-take / double-take-beta pattern already in the repo.

New files: go2rtc-beta/

  • config.yaml — slug go2rtc-beta, image ghcr.io/skrashevich/hassio-addon-go2rtc-beta-{arch}, ingress on 1984, ports 1984/8554/8555 (tcp+udp), log_level schema, config:rw map
  • Dockerfile — three-stage build:
    • build: cross-compiles go2rtc binary from skrashevich/go2rtc@beta using golang:1.26-alpine
    • download-cdn: independently clones the repo to run download_cdn.sh for offline web UI assets — fixes the logical error in the spec where COPY --from=build /src/... referenced source paths that never exist in the build stage (only the compiled binary does)
    • final: alpine:3.21 + s6-overlay 3.1.6.2 + bashio v0.14.3; run.sh bootstraps /config/go2rtc.yaml on first start using bashio::config
  • README.md / CHANGELOG.md — standard addon docs
Original prompt

Задача

Добавить новый Home Assistant addon go2rtc-beta в репозиторий skrashevich/hassio-addons, основанный на ветке beta репозитория skrashevich/go2rtc.

Контекст

Репозиторий уже содержит аддоны с похожей структурой:

  • double-take/ — стабильная версия
  • double-take-beta/ — бета-версия с суффиксом -beta

Нужно создать аналогичную пару: аддон go2rtc-beta (beta-ветка go2rtc).

Структура репозитория go2rtc (ветка beta)

  • Собирается из исходников Go (main.go, go.mod)
  • Docker-образ строится через docker/Dockerfile (multi-stage: build → download-cdn → final alpine+python образ)
  • Порты: 1984 (HTTP/WebUI), 8554 (RTSP), 8555 (WebRTC/TCP), 8555/udp (WebRTC/UDP)
  • Конфиг монтируется в /config
  • Точка входа: /usr/local/bin/entrypoint.sh
  • Поддерживаемые архитектуры: amd64, aarch64, armv7

Что нужно создать

Создать директорию go2rtc-beta/ со следующими файлами:

1. go2rtc-beta/config.yaml

name: go2rtc (Beta)
version: "beta"
url: https://github.com/skrashevich/go2rtc
description: Ultimate camera streaming application with support RTSP, WebRTC, HomeKit, FFmpeg, RTMP, etc. (Beta branch)
panel_icon: mdi:cctv
slug: go2rtc-beta
arch:
  - amd64
  - aarch64
  - armv7
startup: application
boot: auto
ingress: true
ingress_port: 1984
init: false
full_access: false
ports:
  1984/tcp: 1984
  8554/tcp: 8554
  8555/tcp: 8555
  8555/udp: 8555
ports_description:
  1984/tcp: go2rtc WebUI / HTTP API
  8554/tcp: RTSP server
  8555/tcp: WebRTC / PCMU+PCMA TCP
  8555/udp: WebRTC / PCMU+PCMA UDP
map:
  - config:rw
options:
  log_level: info
schema:
  log_level: list(trace|debug|info|warn|error)
image: ghcr.io/skrashevich/hassio-addon-go2rtc-beta-{arch}

2. go2rtc-beta/Dockerfile

Dockerfile должен:

  1. Клонировать или использовать образ из ветки beta репозитория skrashevich/go2rtc
  2. Установить s6-overlay (аналогично другим аддонам в репозитории)
  3. Установить bashio
  4. Добавить скрипт запуска /run.sh, который читает конфиг через bashio и запускает go2rtc
# syntax = docker/dockerfile:1.4
ARG BUILD_FROM

# Build go2rtc from skrashevich/go2rtc:beta
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS build
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH

ENV GOOS=${TARGETOS}
ENV GOARCH=${TARGETARCH}

WORKDIR /build

RUN apk add git

RUN git clone --branch beta --depth 1 https://github.com/skrashevich/go2rtc.git .

RUN --mount=type=cache,target=/root/.cache/go-build go mod download

RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 go build -ldflags "-s -w" -trimpath


# Download CDN dependencies for offline web UI
FROM alpine AS download-cdn
RUN apk add --no-cache wget
RUN git clone --branch beta --depth 1 https://github.com/skrashevich/go2rtc.git /src
COPY --from=build /src/www/ /web/
COPY --from=build /src/docker/download_cdn.sh /tmp/
RUN sh /tmp/download_cdn.sh /web


# Final image
FROM alpine:3.19

ARG S6_OVERLAY_VERSION=3.1.6.2
ARG BUILD_ARCH=amd64

RUN apk add --no-cache \
        bash \
        ca-certificates \
        curl \
        ffmpeg \
        jq \
        tini \
        tzdata \
        xz \
    \
    && S6_ARCH="${BUILD_ARCH}" \
    && if [ "${BUILD_ARCH}" = "i386" ]; then S6_ARCH="i686"; \
    elif [ "${BUILD_ARCH}" = "amd64" ]; then S6_ARCH="x86_64"; \
    elif [ "${BUILD_ARCH}" = "armv7" ]; then S6_ARCH="arm"; \
    elif [ "${BUILD_ARCH}" = "aarch64" ]; then S6_ARCH="aarch64"; fi \
    \
    && curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" \
        | tar -C / -Jxpf - \
    \
    && curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.xz" \
        | tar -C / -Jxpf - \
    \
    && curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz" \
        | tar -C / -Jxpf - \
    \
    && curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz" \
        | tar -C / -Jxpf - \
    \
    && mkdir -p /etc/fix-attrs.d \
    && mkdir -p /etc/services.d

COPY --from=build /build/go2rtc /usr/local/bin/go2rtc
COPY --from=download-cdn /web /var/www/go2rtc

ADD --link https://github.com/hassio-addons/bashio/archive/v0.14.3.tar.gz /tmp/bashio.tar.gz
RUN mkdir -p /tmp/bashio \
    && tar zxvf \
        /tmp/bashio.tar.gz \
        --strip 1 -C /tmp/bashio \
    \
    && mv /tmp/bashio/lib /usr/lib/bashio \
    && ln -s /usr/lib/bashio/bashio /usr/bin/bashio

ENV CONFIG_PATH=/data/options.json

LABEL \
  io.hass.version="beta" \
  io.hass.type="addon" \
  io.hass.arch="aarch64|amd64|armv7"

COPY --chmod=755 <<-EOT /run.sh
#!/usr/bin/with-contenv bashio

LOG_LEVEL=$(bashio::config 'log_level' 'info')

# Generate go2rtc config if not exists
if [ ! -f /config/go2rtc.yaml ]; then
  cat > /config/go2rtc.yaml <<-YAML
api:
  listen: ":...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

<!-- START COPILOT CODING AGENT TIPS -->
---

✨ Let Copilot coding agent [set things up for you](https://github.com/skrashevich/hassio-addons/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: skrashevich <15078499+skrashevich@users.noreply.github.com>
Copilot AI changed the title [WIP] Add go2rtc-beta Home Assistant addon Add go2rtc-beta Home Assistant addon Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants