Enviar arquivos para "/"
This commit is contained in:
19
Dockerfile
19
Dockerfile
@@ -2,12 +2,11 @@ FROM ubuntu:22.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Dependências
|
||||
# Dependências — único passo pesado do build (só pacotes apt)
|
||||
RUN apt-get update && apt-get install -y \
|
||||
qemu-system-x86 \
|
||||
qemu-kvm \
|
||||
qemu-utils \
|
||||
libvirt-clients \
|
||||
xvfb \
|
||||
x11vnc \
|
||||
openbox \
|
||||
@@ -17,26 +16,16 @@ RUN apt-get update && apt-get install -y \
|
||||
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
|
||||
# Cria pasta — ISO e disco são baixados/criados em runtime pelo start.sh
|
||||
RUN mkdir -p /android
|
||||
|
||||
# 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
|
||||
RUN chmod +x /start.sh
|
||||
|
||||
EXPOSE 6080 5555
|
||||
|
||||
|
||||
47
start.sh
47
start.sh
@@ -1,16 +1,55 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Aguarda Xvfb estar pronto
|
||||
sleep 3
|
||||
ISO="/android/android-x86.iso"
|
||||
DISK="/android/android.img"
|
||||
|
||||
# ── Baixa ISO se não existir (primeira execução) ──────────────────────────────
|
||||
if [ ! -f "$ISO" ]; then
|
||||
echo ">>> Baixando Android-x86 9.0 (~900MB)..."
|
||||
wget -q --show-progress \
|
||||
"https://sourceforge.net/projects/android-x86/files/Release%209.0/android-x86_64-9.0-r2.iso/download" \
|
||||
-O "$ISO"
|
||||
echo ">>> Download concluído."
|
||||
fi
|
||||
|
||||
# ── Cria disco e instala Android se não existir ───────────────────────────────
|
||||
if [ ! -f "$DISK" ]; then
|
||||
echo ">>> Criando disco virtual 8GB..."
|
||||
qemu-img create -f qcow2 "$DISK" 8G
|
||||
|
||||
echo ">>> Instalando Android no disco (~3 min)..."
|
||||
qemu-system-x86_64 \
|
||||
-enable-kvm \
|
||||
-m 2048 \
|
||||
-smp 2 \
|
||||
-cpu host \
|
||||
-drive file="$DISK",format=qcow2 \
|
||||
-cdrom "$ISO" \
|
||||
-boot d \
|
||||
-vga virtio \
|
||||
-net nic -net user \
|
||||
-no-reboot \
|
||||
-nographic \
|
||||
-serial mon:stdio \
|
||||
-append "AUTO_INSTALL=1 DATA_PART_SIZE=4096" \
|
||||
&
|
||||
QEMU_PID=$!
|
||||
sleep 180
|
||||
kill $QEMU_PID 2>/dev/null || true
|
||||
echo ">>> Instalação concluída."
|
||||
fi
|
||||
|
||||
# ── Inicia Android TV ─────────────────────────────────────────────────────────
|
||||
echo ">>> Iniciando Android TV..."
|
||||
sleep 3 # aguarda Xvfb (iniciado pelo supervisor)
|
||||
|
||||
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 \
|
||||
-drive file="$DISK",format=qcow2 \
|
||||
-boot c \
|
||||
-vga virtio \
|
||||
-display gtk \
|
||||
|
||||
Reference in New Issue
Block a user