generated from ludops/ludops-skeleton
Fix CI/CD database migration
Build and Deploy / build-and-push (push) Successful in 1m21s
Details
Build and Deploy / build-and-push (push) Successful in 1m21s
Details
This commit is contained in:
parent
7d5c302422
commit
edb0a52e41
|
|
@ -35,7 +35,8 @@ jobs:
|
||||||
docker compose -f docker-compose.prod.yml pull
|
docker compose -f docker-compose.prod.yml pull
|
||||||
docker run --rm --network infrastructure_infra-network \
|
docker run --rm --network infrastructure_infra-network \
|
||||||
-e DATABASE_URL=postgres://gitea:gitea@ludops-postgres:5432/${APP_NAME}_db \
|
-e DATABASE_URL=postgres://gitea:gitea@ludops-postgres:5432/${APP_NAME}_db \
|
||||||
|
-w /app \
|
||||||
${REGISTRY_IMAGE}:latest \
|
${REGISTRY_IMAGE}:latest \
|
||||||
npx drizzle-kit push
|
node_modules/.bin/drizzle-kit push
|
||||||
docker compose -f docker-compose.prod.yml up -d --remove-orphans
|
docker compose -f docker-compose.prod.yml up -d --remove-orphans
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,11 @@ WORKDIR /app
|
||||||
# Copy the standalone API (includes its own local node_modules)
|
# Copy the standalone API (includes its own local node_modules)
|
||||||
COPY --from=build /prod/api .
|
COPY --from=build /prod/api .
|
||||||
|
|
||||||
|
# Copy drizzle config and schemas for migrations
|
||||||
|
COPY --from=build /app/apps/api/drizzle.config.ts ./drizzle.config.ts
|
||||||
|
COPY --from=build /app/apps/api/src/db/schemas.ts ./src/db/schemas.ts
|
||||||
|
COPY --from=build /app/apps/api/src/db/schemas/ ./src/db/schemas/
|
||||||
|
|
||||||
# Copy the web dist into the location the API expects
|
# Copy the web dist into the location the API expects
|
||||||
# Based on your code, it looks for ../web-dist or ./web-dist
|
# Based on your code, it looks for ../web-dist or ./web-dist
|
||||||
COPY --from=build /app/apps/web/dist ./web-dist
|
COPY --from=build /app/apps/web/dist ./web-dist
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ export default {
|
||||||
out: './drizzle',
|
out: './drizzle',
|
||||||
dialect: 'postgresql',
|
dialect: 'postgresql',
|
||||||
dbCredentials: {
|
dbCredentials: {
|
||||||
url: 'postgres://postgres:postgres@localhost:5432/todo_db',
|
// In production, DATABASE_URL is set via docker-compose
|
||||||
|
// In local dev, it falls back to localhost
|
||||||
|
url: process.env.DATABASE_URL || 'postgres://postgres:postgres@localhost:5432/todo_db',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
Loading…
Reference in New Issue