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"]
|
||||
|
||||
Reference in New Issue
Block a user