Skip to content

Commit c958e1d

Browse files
authored
fix: watcher and web dockerfiles (#68)
1 parent aa97914 commit c958e1d

File tree

4 files changed

+26
-19
lines changed

4 files changed

+26
-19
lines changed

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
inject-workspace-packages=true

apps/watcher/Dockerfile

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
1-
FROM node:22-slim
1+
FROM node:22-slim AS build
22

33
WORKDIR /app
44

5-
# Copy built artifacts from monorepo build
6-
# These should be built before docker build with: pnpm build
5+
# Copy monorepo root files
6+
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json .npmrc* ./
7+
8+
# Copy workspace package manifests
9+
COPY apps/watcher/package.json ./apps/watcher/
10+
COPY packages/shared/package.json ./packages/shared/
11+
COPY packages/backend/package.json ./packages/backend/
712

8-
# Watcher
9-
COPY apps/watcher/dist/ ./dist/
13+
# Install pnpm and fetch dependencies
14+
RUN corepack enable && corepack prepare pnpm@latest --activate
15+
RUN pnpm install --frozen-lockfile
1016

11-
# Shared package (squadhub client)
12-
COPY packages/shared/package.json ./node_modules/@clawe/shared/package.json
13-
COPY packages/shared/dist/ ./node_modules/@clawe/shared/dist/
17+
# Copy source and build
18+
COPY packages/shared/ ./packages/shared/
19+
COPY packages/backend/ ./packages/backend/
20+
COPY apps/watcher/ ./apps/watcher/
21+
RUN pnpm build --filter=@clawe/watcher
1422

15-
# Backend (Convex API types)
16-
COPY packages/backend/package.json ./node_modules/@clawe/backend/package.json
17-
COPY packages/backend/convex/_generated/ ./node_modules/@clawe/backend/convex/_generated/
18-
COPY packages/backend/convex/*.ts ./node_modules/@clawe/backend/convex/
23+
# Deploy: extract watcher with all production deps into /app/deploy
24+
RUN pnpm --filter=@clawe/watcher --prod deploy deploy
1925

20-
# Create a clean package.json without workspace:* references (npm doesn't support them)
21-
RUN echo '{"name":"@clawe/watcher","private":true,"type":"module"}' > package.json
26+
# --- Production image ---
27+
FROM node:22-slim
28+
29+
WORKDIR /app
2230

23-
# Install production dependencies
24-
RUN npm install convex axios ws moment-timezone --omit=dev
31+
COPY --from=build /app/deploy .
2532

2633
ENV NODE_ENV=production
2734

apps/web/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ WORKDIR /app
44

55
# Prune monorepo to only web's dependencies
66
FROM base AS pruner
7-
RUN npm install -g turbo@2
87
COPY . .
9-
RUN turbo prune @clawe/web --docker
8+
RUN pnpm dlx turbo prune @clawe/web --docker
109

1110
# Install dependencies (cached unless package.json/lockfile changes)
1211
FROM base AS deps

scripts/convex-deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ if [ -n "$WATCHER_TOKEN" ]; then
4141
fi
4242

4343
# Deploy Convex functions and schema
44-
pnpm --filter @clawe/backend deploy
44+
pnpm --filter @clawe/backend run deploy
4545

4646
echo "==> Convex deployment complete"

0 commit comments

Comments
 (0)