Skip to content

Commit 51d0240

Browse files
[comp] Production Deploy (#1441)
1 parent d6b8856 commit 51d0240

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ RUN echo '{"name":"migrator","type":"module","dependencies":{"prisma":"^6.14.0",
4040
# Install ONLY Prisma dependencies
4141
RUN bun install
4242

43+
# Ensure Prisma can find migrations relative to the published schema path
44+
# We copy the local migrations into the published package's dist directory
45+
RUN cp -R packages/db/prisma/migrations node_modules/@trycompai/db/dist/
46+
4347
# Run migrations against the combined schema published by @trycompai/db
4448
RUN echo "Running migrations against @trycompai/db combined schema"
4549
CMD ["bunx", "prisma", "migrate", "deploy", "--schema=node_modules/@trycompai/db/dist/schema.prisma"]

docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ services:
55
dockerfile: Dockerfile
66
target: migrator
77
env_file:
8-
- .env
8+
- packages/db/.env
99
seeder:
1010
build:
1111
context: .
1212
dockerfile: Dockerfile
1313
target: migrator
1414
env_file:
15-
- .env
15+
- packages/db/.env
1616
command: sh -lc "bunx prisma generate --schema=node_modules/@trycompai/db/dist/schema.prisma && bun packages/db/prisma/seed/seed.js"
1717
app:
1818
build:
@@ -24,7 +24,7 @@ services:
2424
ports:
2525
- '3000:3000'
2626
env_file:
27-
- .env
27+
- apps/app/.env
2828
healthcheck:
2929
test: ['CMD-SHELL', 'curl -f http://localhost:3000/api/health || exit 1']
3030
interval: 30s
@@ -42,7 +42,7 @@ services:
4242
ports:
4343
- '3002:3000'
4444
env_file:
45-
- .env
45+
- apps/portal/.env
4646
healthcheck:
4747
test: ['CMD-SHELL', 'curl -f http://localhost:3002/ || exit 1']
4848
interval: 30s

packages/db/prisma/seed/seed.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ async function seedJsonFiles(subDirectory: string) {
1111
const files = await fs.readdir(directoryPath);
1212
const jsonFiles = files.filter((file) => file.endsWith('.json'));
1313

14+
// Ensure deterministic order for primitives so FK dependencies are satisfied
15+
// Specifically, seed Frameworks before Requirements (which reference Frameworks)
16+
if (subDirectory === 'primitives') {
17+
const priorityOrder = ['FrameworkEditorFramework.json'];
18+
const getPriority = (fileName: string) => {
19+
const index = priorityOrder.indexOf(fileName);
20+
return index === -1 ? Number.MAX_SAFE_INTEGER : index;
21+
};
22+
jsonFiles.sort((a, b) => getPriority(a) - getPriority(b));
23+
}
24+
1425
for (const jsonFile of jsonFiles) {
1526
try {
1627
const filePath = path.join(directoryPath, jsonFile);

0 commit comments

Comments
 (0)