File size: 2,514 Bytes
8abcb4e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3841685
 
 
 
 
8abcb4e
 
 
 
 
 
 
 
 
 
 
 
63ae411
8abcb4e
 
 
63ae411
8abcb4e
 
 
fe3b43d
 
 
87535f5
63ae411
8abcb4e
 
87535f5
63ae411
8abcb4e
 
 
 
 
 
 
63ae411
 
 
8abcb4e
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

# 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"]