Enviar arquivos para "/"
This commit is contained in:
43
Dockerfile
Normal file
43
Dockerfile
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
FROM ubuntu:22.04
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# Dependências
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
qemu-system-x86 \
|
||||||
|
qemu-kvm \
|
||||||
|
qemu-utils \
|
||||||
|
libvirt-clients \
|
||||||
|
xvfb \
|
||||||
|
x11vnc \
|
||||||
|
openbox \
|
||||||
|
novnc \
|
||||||
|
websockify \
|
||||||
|
wget \
|
||||||
|
curl \
|
||||||
|
unzip \
|
||||||
|
supervisor \
|
||||||
|
net-tools \
|
||||||
|
socat \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Baixa Android-x86 (Android 9 com Google Play — melhor compatibilidade)
|
||||||
|
RUN mkdir -p /android && \
|
||||||
|
wget -q "https://sourceforge.net/projects/android-x86/files/Release%209.0/android-x86_64-9.0-r2.iso/download" \
|
||||||
|
-O /android/android-x86.iso
|
||||||
|
|
||||||
|
# Cria disco virtual de 8GB para o Android
|
||||||
|
RUN qemu-img create -f qcow2 /android/android.img 8G
|
||||||
|
|
||||||
|
# Scripts
|
||||||
|
COPY install.sh /install.sh
|
||||||
|
COPY start.sh /start.sh
|
||||||
|
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||||
|
RUN chmod +x /install.sh /start.sh
|
||||||
|
|
||||||
|
# Instala o Android no disco virtual (roda uma vez no build)
|
||||||
|
RUN /install.sh
|
||||||
|
|
||||||
|
EXPOSE 6080 5555
|
||||||
|
|
||||||
|
CMD ["/start.sh"]
|
||||||
58
README.md
Normal file
58
README.md
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
# Android TV via Docker + QEMU
|
||||||
|
|
||||||
|
Android-x86 (Android 9 com Google Play) rodando via QEMU dentro de um container Docker, com acesso pelo browser via noVNC.
|
||||||
|
|
||||||
|
## Requisitos do servidor
|
||||||
|
- Ubuntu 20.04+ ou Debian 11+
|
||||||
|
- KVM habilitado: `ls /dev/kvm` (deve existir)
|
||||||
|
- Mínimo 6GB RAM livre
|
||||||
|
- Mínimo 20GB de espaço em disco
|
||||||
|
|
||||||
|
## Passo a passo
|
||||||
|
|
||||||
|
### 1. Sobe no GitHub
|
||||||
|
```bash
|
||||||
|
git init
|
||||||
|
git add .
|
||||||
|
git commit -m "Android TV Docker"
|
||||||
|
git remote add origin https://github.com/SEU_USER/android-tv.git
|
||||||
|
git push -u origin main
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. No servidor (via SSH) — só uma vez
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/SEU_USER/android-tv.git
|
||||||
|
cd android-tv
|
||||||
|
|
||||||
|
# Build (~5-10 minutos, baixa o ISO do Android-x86)
|
||||||
|
docker build -t android-tv .
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. No Portainer
|
||||||
|
- Vá em **Stacks → Add Stack → Web editor**
|
||||||
|
- Cole o conteúdo do `docker-compose.yml`
|
||||||
|
- Clique em **Deploy the stack**
|
||||||
|
|
||||||
|
### 4. Acesso
|
||||||
|
```
|
||||||
|
http://IP_DO_SERVIDOR:6080/vnc_lite.html
|
||||||
|
```
|
||||||
|
|
||||||
|
## Após o primeiro boot
|
||||||
|
1. Configure o Android normalmente (Wi-Fi, conta Google)
|
||||||
|
2. Instale apps pela Play Store normalmente
|
||||||
|
3. Netflix, YouTube, Prime Video funcionam
|
||||||
|
|
||||||
|
## ADB (opcional)
|
||||||
|
```bash
|
||||||
|
adb connect IP_DO_SERVIDOR:5555
|
||||||
|
adb shell
|
||||||
|
```
|
||||||
|
|
||||||
|
## Atualizar após mudanças no Git
|
||||||
|
```bash
|
||||||
|
cd android-tv
|
||||||
|
git pull
|
||||||
|
docker build -t android-tv .
|
||||||
|
# Restart no Portainer
|
||||||
|
```
|
||||||
28
docker-compose.yml
Normal file
28
docker-compose.yml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# ANTES DE USAR NO PORTAINER:
|
||||||
|
# No servidor via SSH, rode:
|
||||||
|
# git clone https://github.com/SEU_USER/SEU_REPO.git
|
||||||
|
# cd SEU_REPO
|
||||||
|
# docker build -t android-tv .
|
||||||
|
# Depois cole este arquivo no Portainer > Stacks > Add Stack
|
||||||
|
# ============================================================
|
||||||
|
|
||||||
|
services:
|
||||||
|
android-tv:
|
||||||
|
image: android-tv # imagem buildada localmente via SSH
|
||||||
|
container_name: android-tv
|
||||||
|
privileged: true
|
||||||
|
ports:
|
||||||
|
- "6080:6080" # noVNC — http://IP:6080/vnc_lite.html
|
||||||
|
- "5555:5555" # ADB
|
||||||
|
devices:
|
||||||
|
- /dev/kvm:/dev/kvm # KVM obrigatório para performance
|
||||||
|
shm_size: "4gb"
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- android-tv-data:/android/userdata # persiste dados do Android
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
android-tv-data:
|
||||||
41
install.sh
Normal file
41
install.sh
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Esse script roda UMA VEZ durante o docker build
|
||||||
|
# Instala o Android-x86 no disco virtual via QEMU em modo headless
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo ">>> Iniciando instalação do Android-x86 no disco virtual..."
|
||||||
|
|
||||||
|
# Inicia Xvfb para o QEMU ter display
|
||||||
|
Xvfb :99 -screen 0 1920x1080x24 &
|
||||||
|
XVFB_PID=$!
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# Roda o QEMU com o ISO para instalar no disco
|
||||||
|
# auto=true + lang=en_US pula o menu interativo e instala direto
|
||||||
|
DISPLAY=:99 qemu-system-x86_64 \
|
||||||
|
-enable-kvm \
|
||||||
|
-m 2048 \
|
||||||
|
-smp 2 \
|
||||||
|
-cpu host \
|
||||||
|
-drive file=/android/android.img,format=qcow2 \
|
||||||
|
-cdrom /android/android-x86.iso \
|
||||||
|
-boot d \
|
||||||
|
-vga virtio \
|
||||||
|
-net nic \
|
||||||
|
-net user \
|
||||||
|
-append "AUTO_INSTALL=1 DATA_PART_SIZE=4096 SETUP_MOUNTALL=1" \
|
||||||
|
-no-reboot \
|
||||||
|
-nographic \
|
||||||
|
-serial mon:stdio \
|
||||||
|
-kernel /android/android-x86.iso &
|
||||||
|
|
||||||
|
QEMU_PID=$!
|
||||||
|
|
||||||
|
echo ">>> Aguardando instalação (~3 minutos)..."
|
||||||
|
sleep 180
|
||||||
|
|
||||||
|
kill $QEMU_PID 2>/dev/null || true
|
||||||
|
kill $XVFB_PID 2>/dev/null || true
|
||||||
|
|
||||||
|
echo ">>> Instalação concluída."
|
||||||
56
start.sh
Normal file
56
start.sh
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo ">>> Iniciando Xvfb 1920x1080..."
|
||||||
|
Xvfb :0 -screen 0 1920x1080x24 &
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
echo ">>> Iniciando Openbox..."
|
||||||
|
DISPLAY=:0 openbox &
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
echo ">>> Iniciando Android TV via QEMU..."
|
||||||
|
DISPLAY=:0 qemu-system-x86_64 \
|
||||||
|
-enable-kvm \
|
||||||
|
-m 3072 \
|
||||||
|
-smp 4 \
|
||||||
|
-cpu host \
|
||||||
|
-drive file=/android/android.img,format=qcow2 \
|
||||||
|
-boot c \
|
||||||
|
-vga virtio \
|
||||||
|
-display sdl \
|
||||||
|
-net nic \
|
||||||
|
-net user,hostfwd=tcp::5555-:5555 \
|
||||||
|
-usb \
|
||||||
|
-device usb-tablet \
|
||||||
|
-soundhw hda \
|
||||||
|
-full-screen &
|
||||||
|
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
echo ">>> Iniciando x11vnc..."
|
||||||
|
x11vnc \
|
||||||
|
-display :0 \
|
||||||
|
-forever \
|
||||||
|
-shared \
|
||||||
|
-nopw \
|
||||||
|
-quiet \
|
||||||
|
-o /var/log/x11vnc.log &
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
echo ">>> Iniciando noVNC na porta 6080..."
|
||||||
|
websockify \
|
||||||
|
--web /usr/share/novnc \
|
||||||
|
--wrap-mode=ignore \
|
||||||
|
6080 \
|
||||||
|
localhost:5900 &
|
||||||
|
|
||||||
|
echo ">>> Android TV rodando!"
|
||||||
|
echo ">>> Acesse: http://SEU_IP:6080/vnc_lite.html"
|
||||||
|
|
||||||
|
# ADB bridge para o guest
|
||||||
|
socat TCP-LISTEN:5555,fork TCP:localhost:5555 &
|
||||||
|
|
||||||
|
# Mantém container vivo
|
||||||
|
tail -f /dev/null
|
||||||
Reference in New Issue
Block a user