mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-03-15 07:26:44 +08:00
支持v4l2编码,arm机器原生构建,docker镜像换archlinux,允许初始化时禁用HID
This commit is contained in:
@@ -1,38 +1,37 @@
|
||||
# One-KVM Runtime Image
|
||||
# This Dockerfile only packages pre-compiled binaries (no compilation)
|
||||
# Used after cross-compiling with `cross build`
|
||||
# Using Debian 11 for maximum compatibility (GLIBC 2.31)
|
||||
# Using Arch Linux base to match rolling glibc on build hosts.
|
||||
|
||||
ARG TARGETPLATFORM=linux/amd64
|
||||
|
||||
FROM debian:11-slim
|
||||
FROM lsiobase/arch
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
# Install runtime dependencies in a single layer
|
||||
# All codec libraries (libx264, libx265, libopus) are now statically linked
|
||||
# Only hardware acceleration drivers and core system libraries remain dynamic
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
# Core runtime (all platforms) - no codec libs needed
|
||||
RUN pacman -Syu --noconfirm --needed \
|
||||
ca-certificates \
|
||||
libudev1 \
|
||||
libasound2 \
|
||||
# v4l2 is handled by kernel, minimal userspace needed
|
||||
libv4l-0 \
|
||||
systemd-libs \
|
||||
alsa-lib \
|
||||
libv4l \
|
||||
libyuv \
|
||||
ffmpeg \
|
||||
&& \
|
||||
# Platform-specific hardware acceleration
|
||||
if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libva2 libva-drm2 libva-x11-2 libx11-6 libxcb1 libxau6 libxdmcp6 libmfx1; \
|
||||
pacman -S --noconfirm --needed \
|
||||
libva libx11 libxcb libxau libxdmcp libmfx; \
|
||||
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libdrm2 libva2; \
|
||||
pacman -S --noconfirm --needed \
|
||||
libdrm libva; \
|
||||
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libdrm2 libva2; \
|
||||
pacman -S --noconfirm --needed \
|
||||
libdrm libva; \
|
||||
fi && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
pacman -Scc --noconfirm && \
|
||||
mkdir -p /etc/one-kvm/ventoy
|
||||
|
||||
# Copy init script
|
||||
|
||||
@@ -19,8 +19,22 @@ ARCH_MAP=(
|
||||
build_arch() {
|
||||
local rust_target="$1"
|
||||
|
||||
echo "=== Building: $rust_target (via cross with custom Dockerfile) ==="
|
||||
cross build --release --target "$rust_target"
|
||||
# Build frontend first
|
||||
if [ ! -d "$PROJECT_DIR/web/dist" ]; then
|
||||
echo "=== Building Frontend ==="
|
||||
cd "$PROJECT_DIR/web" && npm install && npm run build
|
||||
cd "$PROJECT_DIR"
|
||||
fi
|
||||
|
||||
local host_arch=$(rustc -vV | grep host | cut -d ' ' -f 2)
|
||||
|
||||
if [ "$rust_target" == "$host_arch" ]; then
|
||||
echo "=== Building: $rust_target (NATIVE build, skipping cross) ==="
|
||||
cargo build --release --target "$rust_target"
|
||||
else
|
||||
echo "=== Building: $rust_target (via cross) ==="
|
||||
cross build --release --target "$rust_target"
|
||||
fi
|
||||
}
|
||||
|
||||
# Main
|
||||
|
||||
Reference in New Issue
Block a user