FROM scratch COPY --from=qemux/qemu-docker:6.04 / / ARG VERSION_ARG="0.0" ARG DEBCONF_NOWARNINGS="yes" ARG DEBIAN_FRONTEND="noninteractive" ARG DEBCONF_NONINTERACTIVE_SEEN="true" # 创建一个新用户并设置用户ID RUN useradd -m -u 1000 user # 切换到root用户执行需要root权限的命令 USER root RUN set -eu && \ apt-get update && \ apt-get --no-install-recommends -y install \ bc \ curl \ 7zip \ wsdd \ samba \ xz-utils \ wimtools \ dos2unix \ cabextract \ genisoimage \ libxml2-utils && \ apt-get clean && \ echo "$VERSION_ARG" > /run/version && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # 切换到非root用户 USER user # 设置环境变量和工作目录 ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # 复制文件并设置所有者 COPY --chown=user ./src /run/ COPY --chown=user ./assets /run/assets # 下载并设置文件权限 ADD --chown=user https://raw.githubusercontent.com/christgau/wsdd/v0.8/src/wsdd.py /usr/sbin/wsdd ADD --chown=user https://github.com/qemus/virtiso-whql/releases/download/v1.9.43-0/virtio-win-1.9.43.tar.xz /drivers.txz # 暴露端口和设置卷 EXPOSE 8006 3389 VOLUME /storage # 设置环境变量 ENV RAM_SIZE="4G" ENV CPU_CORES="2" ENV DISK_SIZE="64G" ENV VERSION="win11"