FROM silentwind0/kvmd:latest

RUN ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo Asia/Shanghai > /etc/timezone
RUN apt update \
    && apt-get install -y --no-install-recommends iputils-ping \
    && apt-get install -y --no-install-recommends iproute2 \
    && apt-get install -y --no-install-recommends dmidecode \
    && apt-get install -y --no-install-recommends net-tools \
    && apt-get install -y --no-install-recommends curl \
    && apt-get install -y --no-install-recommends traceroute \
    && apt-get install -y --no-install-recommends iptables \
    && apt-get install -y --no-install-recommends ca-certificates \
    && curl -sSL -O https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb \
    && dpkg -i packages-microsoft-prod.deb \
    && rm packages-microsoft-prod.deb \
    && apt-get update \
    && apt-get install -y libmsquic \
    && apt-get purge -y --auto-remove wget && apt-get clean && rm -rf /var/lib/apt/lists/*


EXPOSE 1802/tcp
EXPOSE 1802/udp
EXPOSE 1804/tcp
EXPOSE 1804/udp
EXPOSE 1806/tcp
EXPOSE 1806/udp
EXPOSE 1807/tcp
EXPOSE 1807/udp
EXPOSE 5900/tcp
EXPOSE 5900/udp
EXPOSE 623/tcp
EXPOSE 623/udp


ENV SNLTTY_LINKER_IS_DOCKER="linker"
ENV DOTNET_ThreadPool_UnfairSemaphoreSpinLimit=0

COPY . /linker/
RUN chmod +x /linker/kvm/linker-kvm.sh
ENTRYPOINT ["/linker/kvm/linker-kvm.sh"]