cursor / Dockerfile
cacode's picture
Upload 48 files
1766992 verified
raw
history blame contribute delete
940 Bytes
# Build stage
FROM golang:1.24-bookworm AS builder
ENV GO111MODULE=on
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Build a static binary
RUN CGO_ENABLED=0 GOOS=linux go build -a -o cursor2api-go .
# Runtime stage
FROM node:20-bookworm-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
ENV PORT=7860
WORKDIR /app
COPY --from=builder /app/cursor2api-go /app/
COPY --from=builder /app/static /app/static
COPY --from=builder /app/jscode /app/jscode
# Non-root user (HF Spaces friendly)
RUN chown -R node:node /app
USER node
EXPOSE 7860
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD node -e "const http=require('http');const port=process.env.PORT||7860;http.get('http://127.0.0.1:'+port+'/health',r=>process.exit(r.statusCode===200?0:1)).on('error',()=>process.exit(1));"
CMD ["./cursor2api-go"]