| FROM node:20-bookworm-slim | |
| ARG WINDSURFAPI_REPO=https://github.com/xiubia/WindsurfAPI.git | |
| ARG WINDSURFAPI_REF=main | |
| ENV NODE_ENV=production \ | |
| PORT=7860 \ | |
| DATA_DIR=/data \ | |
| LS_BINARY_PATH=/opt/windsurf/language_server_linux_x64 \ | |
| LS_PORT=42100 | |
| WORKDIR /app | |
| RUN apt-get update \ | |
| && apt-get install -y --no-install-recommends bash ca-certificates curl git \ | |
| && rm -rf /var/lib/apt/lists/* \ | |
| && git clone --depth 1 --branch "$WINDSURFAPI_REF" "$WINDSURFAPI_REPO" /app \ | |
| && npm install --omit=dev \ | |
| && chmod +x /app/install-ls.sh \ | |
| && bash /app/install-ls.sh \ | |
| && mkdir -p /data /opt/windsurf/data/db /tmp/windsurf-workspace | |
| EXPOSE 7860 | |
| VOLUME ["/data", "/opt/windsurf", "/tmp/windsurf-workspace"] | |
| HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \ | |
| CMD node -e "fetch('http://127.0.0.1:' + (process.env.PORT || 7860) + '/health').then((r) => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))" | |
| CMD ["node", "src/index.js"] | |