mirror of
https://gitcode.com/JianFeeeee/ModelRouter.git
synced 2026-09-20 08:57:57 +00:00
60 lines
2.7 KiB
Docker
60 lines
2.7 KiB
Docker
# ModelRouter GUI Windows builder
|
|
# Self-sufficient cross-compilation environment for the embedded llmsproxy core
|
|
# AND for packaging the Windows NSIS installer.
|
|
#
|
|
# Produces inside a mounted workspace:
|
|
# - llmsproxy.exe (Go, windows/amd64, luajit tag) + lua51.dll
|
|
# - ModelRouter Setup <ver>.exe (electron-builder --win nsis; requires wine
|
|
# so the uninstaller is generated — set USE_SYSTEM_WINE=true)
|
|
#
|
|
# Build: docker build -t modelrouter/win-builder cmd/gui/docker/win-builder
|
|
# Usage: make gui-win-docker (or cmd/gui/scripts/dist-win-docker.sh)
|
|
#
|
|
# This image is the SINGLE wine provider for the NSIS step, so a host that has
|
|
# no / broken wine (e.g. amd64-only Debian: no syswow64 -> c0000135) can still
|
|
# produce a real installer. The NSIS step MUST run inside this image; running it
|
|
# on the host was how the 1.3.0 264 KB degenerate exe got shipped.
|
|
#
|
|
# LuaJIT source is fetched from gitcode.com (CN-reachable mirror) with github
|
|
# fallback; pass --build-arg LUAJIT_REPO to override.
|
|
|
|
FROM golang:1.25
|
|
|
|
ARG LUAJIT_REPO=https://gitcode.com/openresty/luajit2.git
|
|
|
|
# i386 arch is required for wine32 (the NSIS uninstaller step runs a win32 exe
|
|
# through wine's wow64 path, which needs the 32-bit runtime under /usr/lib/i386).
|
|
RUN dpkg --add-architecture i386 \
|
|
&& apt-get update -qq \
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get install -y -qq \
|
|
gcc-mingw-w64-x86-64 make ca-certificates git \
|
|
# NSIS step needs node + the electron-builder toolchain
|
|
nodejs npm \
|
|
# wine (32+64) for generating the NSIS uninstaller
|
|
wine64 wine32:i386 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# electron-builder resolves the uninstaller via the system wine when
|
|
# USE_SYSTEM_WINE=true (or by default on Linux without a toolset). Pin it.
|
|
# The toolchain cache lives in $HOME/.cache (mounted as a volume by
|
|
# dist-win-docker.sh), so it is reused across builds and never pollutes the
|
|
# mounted workspace.
|
|
ENV USE_SYSTEM_WINE=true
|
|
ENV WINEDEBUG=-all
|
|
|
|
# LuaJIT cross-compiled for Windows; keeps lua51.dll and the cgo import lib
|
|
# (libluajit-5.1.dll.a -> libluajit-5.1.a in the mingw lib dir).
|
|
# NOTE: $LUAJIT_REPO deliberately unquoted in "sh -c" — quoting the ARG would
|
|
# embed literal quotes into the URL.
|
|
RUN git clone --depth 1 $LUAJIT_REPO /opt/luajit2 \
|
|
|| git clone --depth 1 https://github.com/openresty/luajit2 /opt/luajit2 \
|
|
&& cd /opt/luajit2 \
|
|
&& make HOST_CC=gcc CROSS=x86_64-w64-mingw32- TARGET_SYS=Windows TARGET_XCFLAGS=-DLUAJIT_ENABLE_LUA52COMPAT \
|
|
&& cp src/libluajit-5.1.dll.a /usr/x86_64-w64-mingw32/lib/libluajit-5.1.a
|
|
|
|
# Go proxy mirror for builds behind GFW-ish networks; overridable at runtime.
|
|
ENV GOPROXY=https://goproxy.cn,direct
|
|
|
|
WORKDIR /workspace
|
|
CMD ["/bin/bash"]
|