Dockerfile fixes (#124)

This commit is contained in:
Chris Estreich 2025-06-23 23:43:37 -07:00 committed by GitHub
parent 075d2d43b1
commit 0fa7270943
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 104 additions and 97 deletions

View file

@ -1,27 +1,27 @@
# docker compose build base api
# docker compose build roomote-api
FROM roomote-base AS base
FROM roo-code-cloud-base AS base
WORKDIR /roo
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml turbo.json ./
COPY packages/config-eslint/package.json ./packages/config-eslint/
COPY packages/config-typescript/package.json ./packages/config-typescript/
COPY packages/types/package.json ./packages/types/
COPY packages/db/package.json ./packages/db/
COPY packages/ipc/package.json ./packages/ipc/
COPY apps/roomote/package.json ./apps/roomote/
COPY scripts/bootstrap.mjs ./scripts/
RUN pnpm install
COPY apps/roomote ./apps/roomote/
COPY packages/config-eslint ./packages/config-eslint/
COPY packages/config-typescript ./packages/config-typescript/
COPY packages/types ./packages/types/
COPY packages/db ./packages/db/
COPY packages/ipc ./packages/ipc/
COPY apps/roomote ./apps/roomote/
WORKDIR /roo/apps/roomote
RUN pnpm build
RUN node_modules/.bin/next build
ENV NODE_ENV=production
EXPOSE 3001
CMD ["pnpm", "start"]
CMD ["node_modules/.bin/next", "start", "--port", "3001"]

View file

@ -1,24 +1,23 @@
# docker compose build base controller
# docker compose build roomote-controller
FROM roomote-base AS base
FROM roo-code-cloud-base AS base
WORKDIR /roo
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY packages/config-eslint/package.json ./packages/config-eslint/
COPY packages/config-typescript/package.json ./packages/config-typescript/
COPY packages/types/package.json ./packages/types/
COPY packages/db/package.json ./packages/db/
COPY packages/ipc/package.json ./packages/ipc/
COPY apps/roomote/package.json ./apps/roomote/
COPY scripts/bootstrap.mjs ./scripts/
RUN pnpm install
COPY apps/roomote ./apps/roomote/
COPY packages/config-eslint ./packages/config-eslint/
COPY packages/config-typescript ./packages/config-typescript/
COPY packages/types ./packages/types/
COPY packages/db ./packages/db/
COPY packages/ipc ./packages/ipc/
COPY apps/roomote ./apps/roomote/
WORKDIR /roo/apps/roomote
ENV NODE_ENV=production

View file

@ -1,23 +1,21 @@
# docker compose build base roomote-dashboard
# docker compose build roomote-dashboard
FROM roomote-base AS base
FROM roo-code-cloud-base AS base
WORKDIR /roo
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY packages/config-eslint/package.json ./packages/config-eslint/
COPY packages/config-typescript/package.json ./packages/config-typescript/
COPY packages/types/package.json ./packages/types/
COPY packages/ipc/package.json ./packages/ipc/
COPY apps/roomote/package.json ./apps/roomote/
COPY apps/roomote-dashboard/package.json ./apps/roomote-dashboard/
COPY scripts/bootstrap.mjs ./scripts/
RUN pnpm install
COPY apps/roomote-dashboard ./apps/roomote-dashboard/
COPY packages/config-eslint ./packages/config-eslint/
COPY packages/config-typescript ./packages/config-typescript/
COPY apps/roomote-dashboard ./apps/roomote-dashboard/
WORKDIR /roo/apps/roomote-dashboard
EXPOSE 3002
CMD ["pnpm", "dev"]

View file

@ -1,7 +1,7 @@
# docker compose build worker
# docker compose build roomote-worker
# Note: Requires $GH_TOKEN to be set as build argument.
FROM roomote-base AS base
FROM roo-code-cloud-base AS base
# Install additional worker-specific packages
RUN apt update && \
@ -44,18 +44,17 @@ WORKDIR /roo
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY packages/config-eslint/package.json ./packages/config-eslint/
COPY packages/config-typescript/package.json ./packages/config-typescript/
COPY packages/types/package.json ./packages/types/
COPY packages/db/package.json ./packages/db/
COPY packages/ipc/package.json ./packages/ipc/
COPY apps/roomote/package.json ./apps/roomote/
COPY scripts/bootstrap.mjs ./scripts/
RUN pnpm install
COPY apps/roomote ./apps/roomote/
COPY packages/config-eslint ./packages/config-eslint/
COPY packages/config-typescript ./packages/config-typescript/
COPY packages/types ./packages/types/
COPY packages/db ./packages/db/
COPY packages/ipc ./packages/ipc/
COPY apps/roomote ./apps/roomote/
WORKDIR /roo/apps/roomote
ENV NODE_ENV=production

30
.dockerignore Normal file
View file

@ -0,0 +1,30 @@
# git
.git
# build artifacts
bin/
dist/
**/dist/
out/
**/out/
# dependencies
node_modules/
**/node_modules/
# testing
coverage/
**/.vscode-test/
**/mock/
# devtools
knip.json
.husky/
# monorepo
.turbo/
**/.turbo/
# next.js
**/.next/
.vercel

View file

@ -1,5 +1,5 @@
DATABASE_URL=postgresql://postgres:password@localhost:5433/cloud_agents
REDIS_URL=redis://localhost:6380
DATABASE_URL=postgres://postgres:password@postgres:5432/development
REDIS_URL=redis://localhost:6379
GH_WEBHOOK_SECRET=your-webhook-secret-here
GH_TOKEN=your-token-here

View file

@ -7,7 +7,6 @@
"check-types": "tsc --noEmit",
"test": "vitest",
"dev": "next dev --port 3001",
"tunnel": "ngrok http 3001 --domain cte.ngrok.dev",
"build": "next build",
"start": "next start --port 3001",
"clean": "rimraf .next .turbo",

View file

@ -1,38 +0,0 @@
#!/bin/bash
# Build script for roomote services.
# This ensures the base image is built before dependent services.
set -e
build_service() {
local service=$1
case $service in
"dashboard"|"api"|"worker"|"controller")
echo "Building base image first..."
docker compose build base
echo "Building $service..."
docker compose build $service
;;
"base")
echo "Building base image..."
docker compose build base
;;
*)
echo "Building $service..."
docker compose build $service
;;
esac
}
if [ $# -eq 0 ]; then
echo "Usage: $0 <service_name>"
echo "Available services: base, dashboard, api, worker, controller, db, redis"
echo "Example: $0 dashboard"
exit 1
fi
build_service $1
echo "Build completed successfully!"

View file

@ -6,7 +6,7 @@ import { db, cloudJobs } from '@roo-code-cloud/db/server';
type Params = Promise<{ id: string }>;
export async function GET(
request856rf8pu9: NextRequest,
_request: NextRequest,
{ params }: { params: Params },
) {
try {

View file

@ -12,7 +12,7 @@ import { processJob } from './job';
// --network roo-code-cloud_default \
// -e HOST_EXECUTION_METHOD=docker \
// -e GH_TOKEN=$GH_TOKEN \
// -e DATABASE_URL=postgresql://postgres:password@db:5432/cloud_agents \
// -e DATABASE_URL=postgres://postgres:password@postgres:5432/development \
// -e REDIS_URL=redis://redis:6379 \
// -e NODE_ENV=production \
// -v /var/run/docker.sock:/var/run/docker.sock \

View file

@ -3,7 +3,7 @@ name: roo-code-cloud
services:
base:
build:
context: ../../
context: .
dockerfile: .docker/Dockerfile.base
image: roo-code-cloud-base
@ -55,7 +55,7 @@ services:
container_name: roo-code-cloud-redis
image: redis:7-alpine
ports:
- "6380:6379"
- "6379:6379"
volumes:
- ./.docker/data/redis:/data
command: redis-server --appendonly yes
@ -63,8 +63,8 @@ services:
roomote-dashboard:
container_name: roo-code-cloud-roomote-dashboard
build:
context: ../../
dockerfile: .docker/Dockerfile.dashboard
context: .
dockerfile: .docker/Dockerfile.roomote-dashboard
image: roo-code-cloud-roomote-dashboard
ports:
- "3002:3002"
@ -78,13 +78,13 @@ services:
roomote-api:
container_name: roo-code-cloud-roomote-api
build:
context: ../../
dockerfile: .docker/Dockerfile.api
context: .
dockerfile: .docker/Dockerfile.roomote-api
image: roo-code-cloud-roomote-api
ports:
- "3001:3001"
environment:
- DATABASE_URL=postgresql://postgres:password@db:5432/cloud_agents
- DATABASE_URL=postgres://postgres:password@postgres:5432/development
- REDIS_URL=redis://redis:6379
- NODE_ENV=production
volumes:
@ -98,8 +98,8 @@ services:
roomote-controller:
container_name: roo-code-cloud-roomote-controller
build:
context: ../../
dockerfile: .docker/Dockerfile.controller
context: .
dockerfile: .docker/Dockerfile.roomote-controller
args:
- GH_TOKEN=${GH_TOKEN}
image: roo-code-cloud-roomote-controller
@ -107,7 +107,7 @@ services:
- .env
environment:
- HOST_EXECUTION_METHOD=docker
- DATABASE_URL=postgresql://postgres:password@db:5432/cloud_agents
- DATABASE_URL=postgres://postgres:password@postgres:5432/development
- REDIS_URL=redis://redis:6379
- NODE_ENV=production
volumes:
@ -122,8 +122,8 @@ services:
roomote-worker:
build:
context: ../../
dockerfile: .docker/Dockerfile.worker
context: .
dockerfile: .docker/Dockerfile.roomote-worker
args:
- GH_TOKEN=${GH_TOKEN}
image: roomote-worker

View file

@ -1,9 +1,6 @@
{
"name": "roo-code-cloud",
"packageManager": "pnpm@10.12.1",
"engines": {
"node": "20.19.2"
},
"scripts": {
"prepare": "husky",
"lint": "turbo lint --log-order grouped --output-logs new-only",
@ -11,13 +8,15 @@
"test": "turbo test --log-order grouped --output-logs new-only",
"build": "turbo build --log-order grouped --output-logs new-only",
"clean": "turbo clean --log-order grouped --output-logs new-only && rimraf .turbo",
"services:up": "docker compose up postgres clickhouse redis roomote-dashboard -d --wait && pnpm db:push",
"services:down": "docker compose down postgres clickhouse redis roomote-dashboard",
"db:up": "docker compose up postgres clickhouse -d --wait && pnpm --filter @roo-code-cloud/db db:migrate && pnpm --filter @roo-code-cloud/db db:test:push --force",
"db:down": "docker compose down postgres clickhouse",
"db:generate": "pnpm --filter @roo-code-cloud/db db:generate",
"db:migrate": "pnpm --filter @roo-code-cloud/db db:migrate",
"db:reset": "pnpm db:down && rimraf .docker/data .docker/logs && pnpm db:up"
"db:reset": "pnpm db:down && rimraf .docker/data .docker/logs && pnpm db:up",
"services:build": "docker compose build base && docker compose build roomote-api roomote-dashboard roomote-controller roomote-worker",
"services:up": "docker compose up redis roomote-dashboard roomote-api -d --wait",
"services:down": "docker compose down redis roomote-dashboard roomote-api",
"tunnel": "ngrok http 3001 --domain cte.ngrok.dev"
},
"devDependencies": {
"@dotenvx/dotenvx": "^1.44.2",

View file

@ -294,12 +294,12 @@ export const agentRequestLogsRelations = relations(
*/
export const cloudJobs = pgTable('cloud_jobs', {
id: integer().primaryKey().generatedAlwaysAsIdentity(),
type: text().notNull().$type<JobType>(),
status: text().notNull().default('pending').$type<JobStatus>(),
payload: jsonb().notNull().$type<JobPayload>(),
result: jsonb(),
error: text(),
id: integer('id').primaryKey().generatedAlwaysAsIdentity(),
type: text('type').notNull().$type<JobType>(),
status: text('status').notNull().default('pending').$type<JobStatus>(),
payload: jsonb('payload').notNull().$type<JobPayload>(),
result: jsonb('result'),
error: text('error'),
slackThreadTs: text('slack_thread_ts'),
startedAt: timestamp('started_at'),
completedAt: timestamp('completed_at'),

View file

@ -2,6 +2,27 @@
export * from './index';
export * from './db';
export * from './schema';
export { db, disconnect, type DatabaseOrTransaction } from './db';
export {
users,
userRelations,
orgs,
orgsRelations,
orgSettings,
orgSettingsRelations,
auditLogs,
auditLogsRelations,
taskShares,
taskSharesRelations,
agents,
agentsRelations,
agentRequestLogs,
agentRequestLogsRelations,
cloudJobs,
type CloudJob,
type InsertCloudJob,
type UpdateCloudJob,
} from './schema';
export * from './queries';