somratpro Claude Sonnet 4.6 commited on
Commit
3182e31
·
1 Parent(s): c3abaa8

fix: resolve Docker build errors

Browse files

- Drop `git checkout main` — Paperclip default branch not main, clone uses default
- Add --depth=1 to clone for faster build
- Remove --frozen-lockfile from pnpm install (lockfile may mismatch)
- Fix health-server deps: local npm install in /app instead of global
- Add --break-system-packages to pip install (required on Debian trixie)
- Copy full Paperclip build dir instead of only dist/
- Add pnpm to runtime stage for start.sh launch
- Fix Paperclip launch: exec pnpm start instead of exec node server.js

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (2) hide show
  1. Dockerfile +16 -23
  2. start.sh +1 -1
Dockerfile CHANGED
@@ -5,19 +5,16 @@ WORKDIR /build
5
 
6
  RUN apt-get update && apt-get install -y \
7
  git \
8
- python3 \
9
- python3-pip \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # Clone Paperclip repository
13
- RUN git clone https://github.com/paperclipai/paperclip.git . && \
14
- git checkout main
15
 
16
  # Install pnpm
17
- RUN npm install -g pnpm@9.15.2
18
 
19
  # Install dependencies
20
- RUN pnpm install --frozen-lockfile
21
 
22
  # Build Paperclip
23
  RUN pnpm build
@@ -35,23 +32,23 @@ RUN apt-get update && apt-get install -y \
35
  postgresql-contrib \
36
  python3 \
37
  python3-pip \
38
- python3-venv \
39
  git \
40
  && rm -rf /var/lib/apt/lists/*
41
 
42
- # Create PostgreSQL data directory
43
  RUN mkdir -p /var/run/postgresql && chown postgres:postgres /var/run/postgresql
44
 
45
- # Install Node dependencies for health-server
46
- RUN npm install -g express@4.18.2 cors@2.8.5 morgan@1.10.0 uuid@9.0.1
47
 
48
  # Install Python dependencies for sync
49
- RUN pip install --no-cache-dir huggingface_hub==0.24.5 PyYAML==6.0.1
50
 
51
- # Copy Paperclip build from builder
52
- COPY --from=paperclip-builder /build/dist /app/paperclip
53
- COPY --from=paperclip-builder /build/package.json /app/paperclip/
54
- COPY --from=paperclip-builder /build/node_modules /app/paperclip/node_modules
 
55
 
56
  # Copy orchestration files
57
  COPY start.sh /app/
@@ -62,19 +59,15 @@ COPY cloudflare-proxy-setup.py /app/
62
  COPY cloudflare-worker.js /app/
63
  COPY setup-uptimerobot.sh /app/
64
 
65
- # Make scripts executable
66
  RUN chmod +x /app/start.sh /app/setup-uptimerobot.sh
67
 
68
- # Create persistent storage directory
69
  RUN mkdir -p /paperclip /var/lib/postgresql/data && \
70
- chown -R postgres:postgres /var/lib/postgresql/data /paperclip
71
-
72
- # Set secure file permissions
73
- RUN umask 0077
74
 
75
  EXPOSE 7861
76
 
77
- HEALTHCHECK --interval=30s --timeout=10s --start-period=90s --retries=3 \
78
  CMD curl -f http://localhost:7861/health || exit 1
79
 
80
  CMD ["/app/start.sh"]
 
5
 
6
  RUN apt-get update && apt-get install -y \
7
  git \
 
 
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
+ # Clone Paperclip (depth=1 for speed, uses repo's default branch)
11
+ RUN git clone --depth=1 https://github.com/paperclipai/paperclip.git .
 
12
 
13
  # Install pnpm
14
+ RUN npm install -g pnpm
15
 
16
  # Install dependencies
17
+ RUN pnpm install
18
 
19
  # Build Paperclip
20
  RUN pnpm build
 
32
  postgresql-contrib \
33
  python3 \
34
  python3-pip \
 
35
  git \
36
  && rm -rf /var/lib/apt/lists/*
37
 
38
+ # Create PostgreSQL runtime directories
39
  RUN mkdir -p /var/run/postgresql && chown postgres:postgres /var/run/postgresql
40
 
41
+ # Install health-server Node dependencies locally in /app
42
+ RUN npm init -y && npm install express@4 cors morgan
43
 
44
  # Install Python dependencies for sync
45
+ RUN pip install --no-cache-dir --break-system-packages huggingface_hub PyYAML
46
 
47
+ # Copy full Paperclip build (including node_modules for runtime)
48
+ COPY --from=paperclip-builder /build /app/paperclip
49
+
50
+ # Ensure pnpm is available in runtime stage
51
+ RUN npm install -g pnpm
52
 
53
  # Copy orchestration files
54
  COPY start.sh /app/
 
59
  COPY cloudflare-worker.js /app/
60
  COPY setup-uptimerobot.sh /app/
61
 
 
62
  RUN chmod +x /app/start.sh /app/setup-uptimerobot.sh
63
 
64
+ # Persistent storage
65
  RUN mkdir -p /paperclip /var/lib/postgresql/data && \
66
+ chown -R postgres:postgres /var/lib/postgresql/data
 
 
 
67
 
68
  EXPOSE 7861
69
 
70
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
71
  CMD curl -f http://localhost:7861/health || exit 1
72
 
73
  CMD ["/app/start.sh"]
start.sh CHANGED
@@ -199,4 +199,4 @@ cleanup() {
199
  trap cleanup SIGTERM SIGINT
200
 
201
  # Start Paperclip in foreground
202
- exec node server.js
 
199
  trap cleanup SIGTERM SIGINT
200
 
201
  # Start Paperclip in foreground
202
+ exec pnpm start