LerinaOwO commited on
Commit
bcfa321
·
verified ·
1 Parent(s): 097fb32

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -54
Dockerfile CHANGED
@@ -1,43 +1,13 @@
1
- # Hugging Face Spaces compatible Dockerfile for cursor2api
2
- # Notes:
3
- # - The original repo's root postinstall assumes ./stealth-proxy already exists,
4
- # so we install with --ignore-scripts first to avoid build failures.
5
- # - Space should expose port 7860.
6
- # - Stealth mode remains optional; default deployment uses CURSOR_COOKIE or external STEALTH_PROXY.
7
 
8
- FROM node:22-slim AS builder
9
-
10
- WORKDIR /app
11
-
12
- RUN apt-get update && apt-get install -y --no-install-recommends \
13
- python3 \
14
- make \
15
- g++ \
16
- ca-certificates \
17
- && rm -rf /var/lib/apt/lists/*
18
-
19
- COPY package.json package-lock.json ./
20
- COPY stealth-proxy/package.json ./stealth-proxy/package.json
21
- COPY stealth-proxy/package-lock.json ./stealth-proxy/package-lock.json
22
-
23
- RUN npm ci --ignore-scripts
24
-
25
- COPY tsconfig.json ./
26
- COPY src ./src
27
- COPY public ./public
28
- COPY start.sh ./start.sh
29
- COPY stealth-proxy/index.js ./stealth-proxy/index.js
30
-
31
- RUN npm run build
32
-
33
-
34
- FROM node:22-slim AS runner
35
 
36
  WORKDIR /app
37
 
38
- ENV NODE_ENV=production
39
- ENV PORT=7860
40
- ENV NODE_OPTIONS=--max-old-space-size=1024
41
 
42
  RUN apt-get update && apt-get install -y --no-install-recommends \
43
  python3 \
@@ -45,32 +15,22 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
45
  g++ \
46
  wget \
47
  ca-certificates \
48
- && rm -rf /var/lib/apt/lists/* \
49
- && groupadd --system --gid 1000 app \
50
- && useradd --system --uid 1000 --gid app appuser
51
 
52
- COPY package.json package-lock.json ./
53
- COPY stealth-proxy/package.json ./stealth-proxy/package.json
54
- COPY stealth-proxy/package-lock.json ./stealth-proxy/package-lock.json
55
 
56
- RUN npm ci --omit=dev --ignore-scripts \
57
- && npm cache clean --force \
58
- && cd stealth-proxy \
59
- && npm install --omit=dev \
60
- && npm cache clean --force
61
 
62
- COPY --from=builder /app/dist ./dist
63
- COPY public ./public
64
- COPY start.sh ./start.sh
65
- COPY stealth-proxy/index.js ./stealth-proxy/index.js
66
- COPY config.yaml ./config.yaml
67
 
68
  RUN mkdir -p /app/logs \
69
  && chmod +x /app/start.sh \
70
- && chown -R appuser:app /app
 
71
 
72
  USER appuser
73
 
74
  EXPOSE 7860
75
 
76
- CMD ["./start.sh"]
 
1
+ FROM node:20-bullseye
 
 
 
 
 
2
 
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+ ENV NODE_ENV=production
5
+ ENV PORT=7860
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  WORKDIR /app
8
 
9
+ COPY package*.json ./
10
+ COPY stealth-proxy/package*.json ./stealth-proxy/
 
11
 
12
  RUN apt-get update && apt-get install -y --no-install-recommends \
13
  python3 \
 
15
  g++ \
16
  wget \
17
  ca-certificates \
18
+ && rm -rf /var/lib/apt/lists/*
 
 
19
 
20
+ RUN npm ci --omit=dev
21
+ RUN cd stealth-proxy && npm ci --omit=dev
 
22
 
23
+ COPY . .
 
 
 
 
24
 
25
+ RUN npx playwright install chromium --with-deps
 
 
 
 
26
 
27
  RUN mkdir -p /app/logs \
28
  && chmod +x /app/start.sh \
29
+ && useradd --system --create-home appuser \
30
+ && chown -R appuser:appuser /app
31
 
32
  USER appuser
33
 
34
  EXPOSE 7860
35
 
36
+ CMD ["./start.sh"]