mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-28 16:41:52 +08:00
fix: 优化 Docker 构建流程并修复 Ventoy 资源路径
- Dockerfile: 合并 RUN 层减少镜像层数,使用 COPY --chmod 简化权限设置 - init.sh: 指定数据目录为 /etc/one-kvm 确保路径一致 - package-docker.sh: 从 libs/ventoy-img-rs/resources 复制资源并自动解压 xz 文件 - README.md: 修正 docker run 示例格式
This commit is contained in:
@@ -8,7 +8,7 @@ FROM debian:12-slim
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
# Install runtime dependencies only (matches build environment)
|
||||
# Install runtime dependencies and create directories
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
# Runtime libraries
|
||||
libasound2 \
|
||||
@@ -38,39 +38,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libxcb1 \
|
||||
# Utilities
|
||||
ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Intel Media SDK runtime for x86_64 only
|
||||
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends libmfx1 && \
|
||||
rm -rf /var/lib/apt/lists/*; \
|
||||
fi
|
||||
|
||||
# Create directories
|
||||
RUN mkdir -p /etc/one-kvm/ventoy
|
||||
# Intel Media SDK (x86_64 only, ignored on other archs)
|
||||
$([ "$TARGETPLATFORM" = "linux/amd64" ] && echo "libmfx1") \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& mkdir -p /etc/one-kvm/ventoy
|
||||
|
||||
# Copy init script
|
||||
COPY init.sh /init.sh
|
||||
COPY --chmod=755 init.sh /init.sh
|
||||
|
||||
# Copy binaries (these are placed by the build script)
|
||||
COPY one-kvm /usr/bin/one-kvm
|
||||
COPY ttyd /usr/bin/ttyd
|
||||
COPY gostc /usr/bin/gostc
|
||||
COPY easytier-core /usr/bin/easytier-core
|
||||
COPY --chmod=755 one-kvm ttyd gostc easytier-core /usr/bin/
|
||||
|
||||
# Copy ventoy resources if they exist
|
||||
COPY ventoy/ /etc/one-kvm/ventoy/
|
||||
|
||||
# Set permissions and verify
|
||||
RUN chmod +x /init.sh /usr/bin/one-kvm /usr/bin/ttyd /usr/bin/gostc /usr/bin/easytier-core && \
|
||||
/usr/bin/one-kvm --help
|
||||
|
||||
# Expose ports
|
||||
EXPOSE 8080 8443
|
||||
|
||||
# Data volume
|
||||
VOLUME ["/etc/one-kvm"]
|
||||
|
||||
# Entrypoint
|
||||
CMD ["/init.sh"]
|
||||
|
||||
Reference in New Issue
Block a user