# Use Node.js on Debian Bullseye (good Wine support) FROM node:20-bullseye # Install Wine and MinGW-w64 (Cross Compiler) RUN dpkg --add-architecture i386 && \ apt-get update && \ apt-get install -y --no-install-recommends \ wine \ wine32 \ wine64 \ libwine \ libwine:i386 \ fonts-wine \ mingw-w64 \ build-essential \ && rm -rf /var/lib/apt/lists/* # Set up app directory WORKDIR /app # Initialize minimal Node environment (No massive frontend deps) RUN npm init -y # Install ONLY what we need RUN npm install express multer @types/express @types/multer typescript tsx # Copy App Source COPY . . # NOTE: We assume the user has copied the Windows SDK to ./sdk-win # In the real build context, we need to make sure this path aligns. # For now, we assume the build context includes the SDK at services/skp-converter/sdk-win or similar. # BUT, the SDK is in Documentation/SDK_WIN_x64_2026-1-185. # We will instruct the user to COPY it or we will reference it if context allows. # For this Dockerfile, we expect the SDK to be available at build time. # Create output dir RUN mkdir -p services/processor/bin # Environment Variables ENV USE_WINE=true ENV WINEPATH="/app/services/processor/bin" # Suppress Wine debug messages ENV WINEDEBUG=-all # Decode Libs (Bypass HF Binary Check) - Using Node.js for reliability # The script is at /app/services/processor/decode_libs.js RUN node /app/services/processor/decode_libs.js RUN ls -la ./Documentation/SDK_WIN_x64_2026-1-185/binaries/sketchup/x64/ # Build Script (Inline) # We cross-compile main.cpp -> skp_converter.exe RUN x86_64-w64-mingw32-g++ -v -o services/processor/bin/skp_converter.exe \ services/processor/src/main.cpp \ -I "./Documentation/SDK_WIN_x64_2026-1-185/headers" \ -L "./Documentation/SDK_WIN_x64_2026-1-185/binaries/sketchup/x64" \ -lSketchUpAPI \ -static-libgcc -static-libstdc++ -lpthread \ -DUNICODE -D_UNICODE # Copy DLLs to bin (Runtime requirement) RUN cp "./Documentation/SDK_WIN_x64_2026-1-185/binaries/sketchup/x64/SketchUpAPI.dll" services/processor/bin/ RUN cp "./Documentation/SDK_WIN_x64_2026-1-185/binaries/sketchup/x64/SketchUpCommonPreferences.dll" services/processor/bin/ RUN cp "./Documentation/SDK_WIN_x64_2026-1-185/binaries/sketchup/x64/SketchUpAPI.lib" services/processor/bin/ # Expose Port (Hugging Face / RunPod Default) EXPOSE 7860 # Start Command # Run the standalone Express server directly CMD ["npx", "tsx", "services/skp-converter/server.ts"]