Enviar arquivos para "/"
This commit is contained in:
19
Dockerfile
19
Dockerfile
@@ -2,12 +2,11 @@ FROM ubuntu:22.04
|
|||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# Dependências
|
# Dependências — único passo pesado do build (só pacotes apt)
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
qemu-system-x86 \
|
qemu-system-x86 \
|
||||||
qemu-kvm \
|
qemu-kvm \
|
||||||
qemu-utils \
|
qemu-utils \
|
||||||
libvirt-clients \
|
|
||||||
xvfb \
|
xvfb \
|
||||||
x11vnc \
|
x11vnc \
|
||||||
openbox \
|
openbox \
|
||||||
@@ -17,26 +16,16 @@ RUN apt-get update && apt-get install -y \
|
|||||||
curl \
|
curl \
|
||||||
unzip \
|
unzip \
|
||||||
supervisor \
|
supervisor \
|
||||||
net-tools \
|
|
||||||
socat \
|
socat \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Baixa Android-x86 (Android 9 com Google Play — melhor compatibilidade)
|
# Cria pasta — ISO e disco são baixados/criados em runtime pelo start.sh
|
||||||
RUN mkdir -p /android && \
|
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
|
# Scripts
|
||||||
COPY install.sh /install.sh
|
|
||||||
COPY start.sh /start.sh
|
COPY start.sh /start.sh
|
||||||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||||
RUN chmod +x /install.sh /start.sh
|
RUN chmod +x /start.sh
|
||||||
|
|
||||||
# Instala o Android no disco virtual (roda uma vez no build)
|
|
||||||
RUN /install.sh
|
|
||||||
|
|
||||||
EXPOSE 6080 5555
|
EXPOSE 6080 5555
|
||||||
|
|
||||||
|
|||||||
71
start.sh
71
start.sh
@@ -1,23 +1,62 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Aguarda Xvfb estar pronto
|
ISO="/android/android-x86.iso"
|
||||||
sleep 3
|
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 \
|
DISPLAY=:0 qemu-system-x86_64 \
|
||||||
-enable-kvm \
|
-enable-kvm \
|
||||||
-m 3072 \
|
-m 3072 \
|
||||||
-smp 4 \
|
-smp 4 \
|
||||||
-cpu host \
|
-cpu host \
|
||||||
-drive file=/android/android.img,format=qcow2 \
|
-drive file="$DISK",format=qcow2 \
|
||||||
-boot c \
|
-boot c \
|
||||||
-vga virtio \
|
-vga virtio \
|
||||||
-display gtk \
|
-display gtk \
|
||||||
-net nic \
|
-net nic \
|
||||||
-net user,hostfwd=tcp::5555-:5555 \
|
-net user,hostfwd=tcp::5555-:5555 \
|
||||||
-usb \
|
-usb \
|
||||||
-device usb-tablet \
|
-device usb-tablet \
|
||||||
-full-screen
|
-full-screen
|
||||||
|
|
||||||
echo ">>> QEMU encerrado."
|
echo ">>> QEMU encerrado."
|
||||||
|
|||||||
Reference in New Issue
Block a user