File size: 1,257 Bytes
d46916f
a130a5b
d46916f
 
 
 
0efe9dd
 
 
 
 
d46916f
 
 
0efe9dd
 
 
 
 
c14f880
0efe9dd
 
 
 
d46916f
9f948a0
d46916f
ed96a6c
d46916f
 
a130a5b
 
 
150cfd9
0efe9dd
e19bcea
 
03ae0dd
e19bcea
 
 
 
ed96a6c
d46916f
 
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
FROM archlinux:base

WORKDIR /app
RUN pacman -Syu --noconfirm && \
    pacman -S --noconfirm curl git bun && \
    pacman -Scc --noconfirm && \
    mkdir -p /opt/windsurf/data/db && \
    git clone --depth 1 https://github.com/dwgx/WindsurfAPI.git . && \
    bash install-ls.sh

COPY <<-"EOF" /app/resolv.conf
nameserver 1.1.1.1
nameserver 1.0.0.1
nameserver 2606:4700:4700::1111
nameserver 2606:4700:4700::1002
EOF

COPY --chmod=755 <<-"EOF" /entrypoint.sh
#!/bin/sh
cat /app/resolv.conf > /etc/resolv.conf
exec "$@"
EOF

COPY <<-"EOF" /app/.env
PORT=7860
HOST=0.0.0.0
DEFAULT_MODEL=gemini-2.5-flash
LOG_LEVEL=warn
LS_BINARY_PATH=/opt/windsurf/language_server_linux_x64
LS_PORT=42100
# это вынесено в секреты на вкладке настроек:
# DASHBOARD_PASSWORD
# API_KEY
EOF

COPY <<-"EOF" /tmp/patch.js
const server = startServer();
log.warn("\n\n==========================================\n\n⚠️ GO TO https://USERNAME-SPACENAME.hf.space/dashboard\n\n==========================================\n\n")
EOF

RUN sed -i -e '/const server = startServer();/r /tmp/patch.js' -e '/const server = startServer();/d' /app/src/index.js && \
    rm /tmp/patch.js
EXPOSE 42100
ENTRYPOINT ["/entrypoint.sh"]
CMD ["bun", "/app/src/index.js"]