Update Dockerfile
Browse files- Dockerfile +126 -43
Dockerfile
CHANGED
@@ -6,16 +6,16 @@ ENV WINEDEBUG=-all
|
|
6 |
ENV DISPLAY=:99
|
7 |
ENV WINEARCH=win64
|
8 |
ENV WINEPREFIX=/root/.wine
|
|
|
|
|
9 |
|
10 |
-
# Install dependencies
|
11 |
RUN apt-get update && apt-get install -y \
|
12 |
software-properties-common \
|
13 |
apt-transport-https \
|
14 |
wget \
|
15 |
gnupg2 \
|
16 |
xvfb \
|
17 |
-
x11vnc \
|
18 |
-
fluxbox \
|
19 |
sudo \
|
20 |
cabextract \
|
21 |
xz-utils \
|
@@ -34,17 +34,33 @@ RUN wget -nc https://dl.winehq.org/wine-builds/winehq.key \
|
|
34 |
# Install Wine and winetricks
|
35 |
RUN apt-get install -y --install-recommends winehq-devel winetricks
|
36 |
|
37 |
-
#
|
38 |
-
RUN mkdir -p /root
|
39 |
-
RUN echo '[Software\\\\Wine\\\\X11 Driver]' > /root/.wine/user.reg.d/graphics.reg \
|
40 |
-
&& echo '"Decorated"="N"' >> /root/.wine/user.reg.d/graphics.reg \
|
41 |
-
&& echo '"Managed"="N"' >> /root/.wine/user.reg.d/graphics.reg
|
42 |
|
43 |
-
#
|
44 |
-
RUN
|
|
|
|
|
|
|
45 |
|
46 |
-
#
|
47 |
-
RUN
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
# Create directory for CapCut files
|
50 |
RUN mkdir -p /opt/capcut
|
@@ -54,41 +70,108 @@ RUN mkdir -p /tmp/capcut-download \
|
|
54 |
&& cd /tmp/capcut-download \
|
55 |
&& wget -O capcut_setup.exe "https://lf16-capcut.faceulv.com/obj/capcutpc-packages-us/packages/CapCut_setup_9.9.0_capcutpc_0_us.exe" \
|
56 |
&& echo "Extracting CapCut installer..." \
|
57 |
-
&&
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
60 |
&& rm -rf /tmp/capcut-download
|
61 |
|
62 |
-
#
|
63 |
RUN echo '#!/bin/bash \n\
|
64 |
-
#
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
# Set aspect ratio to fix black preview issue \n\
|
76 |
-
|
77 |
-
|
78 |
-
wine
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
wine capcut.exe \n\
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
fi \n\
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
-
|
|
|
90 |
|
91 |
-
#
|
92 |
-
|
93 |
|
94 |
-
|
|
|
|
6 |
ENV DISPLAY=:99
|
7 |
ENV WINEARCH=win64
|
8 |
ENV WINEPREFIX=/root/.wine
|
9 |
+
# Fix for XDG_RUNTIME_DIR error
|
10 |
+
ENV XDG_RUNTIME_DIR=/tmp/runtime-root
|
11 |
|
12 |
+
# Install dependencies (minimal headless setup)
|
13 |
RUN apt-get update && apt-get install -y \
|
14 |
software-properties-common \
|
15 |
apt-transport-https \
|
16 |
wget \
|
17 |
gnupg2 \
|
18 |
xvfb \
|
|
|
|
|
19 |
sudo \
|
20 |
cabextract \
|
21 |
xz-utils \
|
|
|
34 |
# Install Wine and winetricks
|
35 |
RUN apt-get install -y --install-recommends winehq-devel winetricks
|
36 |
|
37 |
+
# Create XDG_RUNTIME_DIR to avoid errors
|
38 |
+
RUN mkdir -p /tmp/runtime-root && chmod 700 /tmp/runtime-root
|
|
|
|
|
|
|
39 |
|
40 |
+
# Initialize wine
|
41 |
+
RUN Xvfb :99 -screen 0 1024x768x16 & \
|
42 |
+
sleep 2 && \
|
43 |
+
DISPLAY=:99 wine wineboot --init && \
|
44 |
+
wineserver -w
|
45 |
|
46 |
+
# Configure Wine settings
|
47 |
+
RUN Xvfb :99 -screen 0 1024x768x16 & \
|
48 |
+
sleep 2 && \
|
49 |
+
DISPLAY=:99 winecfg -v win11 && \
|
50 |
+
# Disable window manager decorations and control
|
51 |
+
echo '[Software\\\\Wine\\\\X11 Driver]' > /tmp/graphics.reg && \
|
52 |
+
echo '"Decorated"="N"' >> /tmp/graphics.reg && \
|
53 |
+
echo '"Managed"="N"' >> /tmp/graphics.reg && \
|
54 |
+
DISPLAY=:99 wine regedit /tmp/graphics.reg && \
|
55 |
+
rm /tmp/graphics.reg && \
|
56 |
+
wineserver -w
|
57 |
+
|
58 |
+
# Install Windows components using winetricks
|
59 |
+
RUN Xvfb :99 -screen 0 1024x768x16 & \
|
60 |
+
sleep 2 && \
|
61 |
+
DISPLAY=:99 winetricks -q vcrun2019 && \
|
62 |
+
DISPLAY=:99 winetricks -q corefonts && \
|
63 |
+
wineserver -w
|
64 |
|
65 |
# Create directory for CapCut files
|
66 |
RUN mkdir -p /opt/capcut
|
|
|
70 |
&& cd /tmp/capcut-download \
|
71 |
&& wget -O capcut_setup.exe "https://lf16-capcut.faceulv.com/obj/capcutpc-packages-us/packages/CapCut_setup_9.9.0_capcutpc_0_us.exe" \
|
72 |
&& echo "Extracting CapCut installer..." \
|
73 |
+
&& Xvfb :99 -screen 0 1024x768x16 & \
|
74 |
+
sleep 2 && \
|
75 |
+
DISPLAY=:99 wine capcut_setup.exe /S /D=C:\\CapCut \
|
76 |
+
&& sleep 30 \
|
77 |
+
&& wineserver -w \
|
78 |
+
&& cp -r "$WINEPREFIX/drive_c/CapCut/"* /opt/capcut/ 2>/dev/null || true \
|
79 |
&& rm -rf /tmp/capcut-download
|
80 |
|
81 |
+
# Create a headless command script for CapCut operations
|
82 |
RUN echo '#!/bin/bash \n\
|
83 |
+
# Function to run a CapCut command with proper setup \n\
|
84 |
+
run_capcut_command() { \n\
|
85 |
+
# Create runtime directory \n\
|
86 |
+
mkdir -p $XDG_RUNTIME_DIR \n\
|
87 |
+
chmod 700 $XDG_RUNTIME_DIR \n\
|
88 |
+
\n\
|
89 |
+
# Start virtual display in background \n\
|
90 |
+
Xvfb :99 -screen 0 1920x1080x24 & \n\
|
91 |
+
XVFB_PID=$! \n\
|
92 |
+
sleep 2 \n\
|
93 |
+
\n\
|
94 |
+
# Set aspect ratio to fix black preview issue \n\
|
95 |
+
echo "[HKEY_CURRENT_USER\\\\Software\\\\ByteDance\\\\CapCut]" > /tmp/capcut_settings.reg \n\
|
96 |
+
echo "\"AspectRatio\"=\"16:9\"" >> /tmp/capcut_settings.reg \n\
|
97 |
+
DISPLAY=:99 wine regedit /tmp/capcut_settings.reg \n\
|
98 |
+
rm /tmp/capcut_settings.reg \n\
|
99 |
+
\n\
|
100 |
+
# Run the command \n\
|
101 |
+
cd /opt/capcut \n\
|
102 |
+
DISPLAY=:99 wine capcut.exe $@ \n\
|
103 |
+
\n\
|
104 |
+
# Clean up \n\
|
105 |
+
kill $XVFB_PID \n\
|
106 |
+
} \n\
|
107 |
+
\n\
|
108 |
+
# Process input and project files if mounted \n\
|
109 |
+
if [ -d "/input" ]; then \n\
|
110 |
+
cp -r /input/* /opt/capcut/projects/ 2>/dev/null || true \n\
|
111 |
fi \n\
|
112 |
+
\n\
|
113 |
+
# Handle command line arguments \n\
|
114 |
+
case "$1" in \n\
|
115 |
+
"process") \n\
|
116 |
+
# Example: Process a project file \n\
|
117 |
+
if [ -n "$2" ]; then \n\
|
118 |
+
PROJECT_FILE="$2" \n\
|
119 |
+
OUTPUT_PATH="${3:-/output}" \n\
|
120 |
+
echo "Processing project: $PROJECT_FILE" \n\
|
121 |
+
run_capcut_command --headless --process "$PROJECT_FILE" --output "$OUTPUT_PATH" \n\
|
122 |
+
else \n\
|
123 |
+
echo "Error: No project file specified" \n\
|
124 |
+
exit 1 \n\
|
125 |
+
fi \n\
|
126 |
+
;; \n\
|
127 |
+
"export") \n\
|
128 |
+
# Example: Export a project \n\
|
129 |
+
if [ -n "$2" ]; then \n\
|
130 |
+
PROJECT_FILE="$2" \n\
|
131 |
+
OUTPUT_PATH="${3:-/output}" \n\
|
132 |
+
echo "Exporting project: $PROJECT_FILE" \n\
|
133 |
+
run_capcut_command --headless --export "$PROJECT_FILE" --output "$OUTPUT_PATH" \n\
|
134 |
+
else \n\
|
135 |
+
echo "Error: No project file specified" \n\
|
136 |
+
exit 1 \n\
|
137 |
+
fi \n\
|
138 |
+
;; \n\
|
139 |
+
"render") \n\
|
140 |
+
# Example: Render a project \n\
|
141 |
+
if [ -n "$2" ]; then \n\
|
142 |
+
PROJECT_FILE="$2" \n\
|
143 |
+
OUTPUT_PATH="${3:-/output}" \n\
|
144 |
+
echo "Rendering project: $PROJECT_FILE" \n\
|
145 |
+
run_capcut_command --headless --render "$PROJECT_FILE" --output "$OUTPUT_PATH" \n\
|
146 |
+
else \n\
|
147 |
+
echo "Error: No project file specified" \n\
|
148 |
+
exit 1 \n\
|
149 |
+
fi \n\
|
150 |
+
;; \n\
|
151 |
+
"custom") \n\
|
152 |
+
# Run custom CapCut command \n\
|
153 |
+
shift \n\
|
154 |
+
echo "Running custom command: $@" \n\
|
155 |
+
run_capcut_command $@ \n\
|
156 |
+
;; \n\
|
157 |
+
*) \n\
|
158 |
+
# Default: Just run CapCut with provided arguments \n\
|
159 |
+
echo "Running CapCut with arguments: $@" \n\
|
160 |
+
run_capcut_command $@ \n\
|
161 |
+
;; \n\
|
162 |
+
esac \n\
|
163 |
+
' > /usr/local/bin/capcut-cli
|
164 |
+
|
165 |
+
RUN chmod +x /usr/local/bin/capcut-cli
|
166 |
+
|
167 |
+
# Create output directory
|
168 |
+
RUN mkdir -p /output
|
169 |
|
170 |
+
# Create directories for projects
|
171 |
+
RUN mkdir -p /opt/capcut/projects
|
172 |
|
173 |
+
# Set the entrypoint to our headless command script
|
174 |
+
ENTRYPOINT ["/usr/local/bin/capcut-cli"]
|
175 |
|
176 |
+
# Default command (can be overridden)
|
177 |
+
CMD ["--help"]
|