Migrate to Chromium, unified VNC, thumbnails, autologin CDP detection
--- - Migrado base Docker de ubuntu:22.04 + Google Chrome para debian:bookworm-slim + Chromium - Dockerfile refatorado com multi-stage build (node:22-alpine builder + debian runtime) e single RUN layer para imagem menor - VNC unificado: removido novnc por stream, substituído por websockify global na porta 6080 com token-based routing - Implementado sistema de thumbnails por stream via ffmpeg (captura do HLS) com endpoint GET/POST e atualização no card - Autologin reescrito com detecção via Chrome DevTools Protocol: pula credenciais se já autenticado - Adicionado padrão desiredState (running/stopped) persistido no JSON, restaurado via restore-streams.sh ao reiniciar container - UI traduzida para inglês, formulário reorganizado com tooltips, seção avançada colapsável e GOP automático - Player simplificado: modos HLS e HTML unificados, removido modo m3u8 separado - Adicionado campo threads no ffmpeg; suporte a seccomp:unconfined no docker-compose ---
This commit is contained in:
+46
-40
@@ -1,55 +1,61 @@
|
||||
FROM ubuntu:22.04
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=America/Sao_Paulo
|
||||
|
||||
# ── Sistema base ─────────────────────────────────────────────────────────────
|
||||
RUN apt-get update && apt-get install -y \
|
||||
xvfb x11vnc novnc websockify \
|
||||
ffmpeg supervisor curl wget gnupg xdotool tzdata \
|
||||
--no-install-recommends && \
|
||||
ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
|
||||
wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
|
||||
apt-get install -y ./google-chrome-stable_current_amd64.deb && \
|
||||
rm google-chrome-stable_current_amd64.deb && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# ── Node.js 22 ───────────────────────────────────────────────────────────────
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
|
||||
apt-get install -y nodejs && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# ── MediaMTX ─────────────────────────────────────────────────────────────────
|
||||
ARG MEDIAMTX_VERSION=1.17.1
|
||||
RUN wget -q "https://github.com/bluenviron/mediamtx/releases/download/v${MEDIAMTX_VERSION}/mediamtx_v${MEDIAMTX_VERSION}_linux_amd64.tar.gz" -O /tmp/mediamtx.tar.gz && \
|
||||
tar -xzf /tmp/mediamtx.tar.gz -C /usr/local/bin mediamtx && \
|
||||
rm /tmp/mediamtx.tar.gz
|
||||
|
||||
# ── Next.js build ────────────────────────────────────────────────────────────
|
||||
# ── Stage 1: Next.js build ───────────────────────────────────────────────────
|
||||
FROM node:22-alpine AS builder
|
||||
WORKDIR /build
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY src/ ./src/
|
||||
COPY next.config.ts tsconfig.json postcss.config.mjs ./
|
||||
RUN npm run build
|
||||
|
||||
# ── Montar app standalone ────────────────────────────────────────────────────
|
||||
RUN mkdir -p /app/.next && \
|
||||
cp -r .next/standalone/. /app/ && \
|
||||
cp -r .next/static /app/.next/static && \
|
||||
mkdir -p /app/public && \
|
||||
(cp -r public/. /app/public/ 2>/dev/null || true)
|
||||
# ── Stage 2: runtime ─────────────────────────────────────────────────────────
|
||||
FROM debian:bookworm-slim
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
ARG MEDIAMTX_VERSION=1.17.1
|
||||
|
||||
# Tudo em um único RUN para que o cleanup seja efetivo no tamanho final
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
xvfb x11vnc novnc websockify \
|
||||
ffmpeg supervisor xdotool tzdata \
|
||||
chromium \
|
||||
curl gnupg \
|
||||
&& ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \
|
||||
\
|
||||
# Node.js 22
|
||||
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
||||
&& apt-get install -y --no-install-recommends nodejs \
|
||||
\
|
||||
# MediaMTX
|
||||
&& curl -fsSL "https://github.com/bluenviron/mediamtx/releases/download/v${MEDIAMTX_VERSION}/mediamtx_v${MEDIAMTX_VERSION}_linux_amd64.tar.gz" \
|
||||
-o /tmp/mediamtx.tar.gz \
|
||||
&& tar -xzf /tmp/mediamtx.tar.gz -C /usr/local/bin mediamtx \
|
||||
\
|
||||
# Remove ferramentas usadas só no build
|
||||
&& apt-get remove -y curl gnupg \
|
||||
&& apt-get autoremove -y \
|
||||
&& apt-get clean \
|
||||
&& find /usr/lib/chromium/locales -name '*.pak' ! -name 'en-US.pak' -delete \
|
||||
&& rm -rf \
|
||||
/var/lib/apt/lists/* \
|
||||
/tmp/* /var/tmp/* \
|
||||
/usr/share/doc \
|
||||
/usr/share/man \
|
||||
/usr/share/locale \
|
||||
/usr/lib/locale
|
||||
|
||||
COPY --from=builder /build/.next/standalone/ /app/
|
||||
COPY --from=builder /build/.next/static/ /app/.next/static/
|
||||
|
||||
# ── Configs e scripts ────────────────────────────────────────────────────────
|
||||
COPY config/supervisord.conf /etc/supervisor/supervisord.conf
|
||||
COPY config/mediamtx.yml /etc/mediamtx.yml
|
||||
COPY scripts/ /opt/scripts/
|
||||
RUN chmod +x /opt/scripts/*.sh
|
||||
|
||||
# ── Entrypoint ───────────────────────────────────────────────────────────────
|
||||
COPY docker/entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
RUN chmod +x /opt/scripts/*.sh /entrypoint.sh
|
||||
|
||||
VOLUME ["/app/data"]
|
||||
EXPOSE 3000 1935 8888 6081
|
||||
EXPOSE 3000 1935 8888 6080
|
||||
|
||||
CMD ["/entrypoint.sh"]
|
||||
CMD ["/entrypoint.sh"]
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
SHELL := /bin/bash
|
||||
IMAGE ?= git.kralot.cloud/decap-stream
|
||||
IMAGE ?= git.kralot.cloud/kralot/decap-stream
|
||||
TAG ?= ""
|
||||
|
||||
.PHONY: build push
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
services:
|
||||
decap-stream:
|
||||
image: git.kralot.cloud/decap-stream:latest
|
||||
image: git.kralot.cloud/kralot/decap-stream:latest
|
||||
container_name: decap-stream
|
||||
restart: unless-stopped
|
||||
shm_size: "2gb"
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
environment:
|
||||
TZ: America/Sao_Paulo
|
||||
ports:
|
||||
- "3000:3000" # Web UI
|
||||
- "1935:1935" # RTMP (MediaMTX)
|
||||
- "8888:8888" # HLS (MediaMTX)
|
||||
- "6081:6081" # VNC (noVNC)
|
||||
- "6080:6080" # VNC (noVNC)
|
||||
volumes:
|
||||
- decap-stream:/app/data
|
||||
|
||||
|
||||
+13
-5
@@ -1,13 +1,21 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Garante estrutura de dados persistente
|
||||
mkdir -p /app/data/streams
|
||||
mkdir -p /app/data/logs
|
||||
mkdir -p /app/data/vnc-tokens
|
||||
|
||||
# Restaura streams que existiam antes de um restart
|
||||
# O supervisord já vai incluir os stream.conf via [include]
|
||||
# Garante que os scripts têm permissão de execução
|
||||
find /app/data/streams -name "*.sh" -exec chmod +x {} \;
|
||||
|
||||
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
|
||||
# #19 — restaura streams para o desiredState após restart do container
|
||||
NODE_PATH=/app/node_modules node -e "
|
||||
const fs = require('fs');
|
||||
const { execSync } = require('child_process');
|
||||
const streamsFile = '/app/data/streams.json';
|
||||
if (!fs.existsSync(streamsFile)) process.exit(0);
|
||||
const streams = JSON.parse(fs.readFileSync(streamsFile, 'utf-8'));
|
||||
// Apenas aguarda o supervisord estar pronto, o restore ocorre via script separado
|
||||
fs.writeFileSync('/app/data/.pending-restore', JSON.stringify(streams.map(s => ({ id: s.id, desiredState: s.desiredState }))));
|
||||
" 2>/dev/null || true
|
||||
|
||||
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
|
||||
|
||||
Reference in New Issue
Block a user