Skip to content

Commit 1430ebc

Browse files
committed
fix: include prisma runtime dependencies
1 parent 5621c04 commit 1430ebc

5 files changed

Lines changed: 24 additions & 6 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,18 @@ jobs:
134134
cd ${MURUN_DEPLOY_DIR:-~/murun-peterabcd/deploy}
135135
export IMAGE_TAG="${{ needs.build.outputs.image_tag }}"
136136
export MURUN_ENV_FILE=".env.${{ needs.build.outputs.target }}"
137+
on_error() {
138+
echo "::group::docker compose ps"
139+
docker compose -p murun-${{ needs.build.outputs.target }} --env-file "$MURUN_ENV_FILE" ps || true
140+
echo "::endgroup::"
141+
echo "::group::app logs"
142+
docker compose -p murun-${{ needs.build.outputs.target }} --env-file "$MURUN_ENV_FILE" logs --tail=160 app || true
143+
echo "::endgroup::"
144+
echo "::group::caddy logs"
145+
docker compose -p murun-${{ needs.build.outputs.target }} --env-file "$MURUN_ENV_FILE" logs --tail=80 caddy || true
146+
echo "::endgroup::"
147+
}
148+
trap on_error ERR
137149
docker compose -p murun-${{ needs.build.outputs.target }} --env-file "$MURUN_ENV_FILE" pull
138150
docker compose -p murun-${{ needs.build.outputs.target }} --env-file "$MURUN_ENV_FILE" up -d --remove-orphans
139151
docker image prune -f

app/api/health/route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function GET() {
2+
return Response.json({ ok: true });
3+
}

deploy/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,10 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
4545
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
4646
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
4747

48-
# Prisma: migration 적용에 필요한 CLI + schema + 이미 생성된 client
48+
# Prisma migrate deploy 는 CLI 의 transitive deps(effect 등)가 필요하므로
49+
# standalone trace 의 최소 node_modules 대신 builder 의 전체 install tree 를 사용한다.
4950
COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma
50-
COPY --from=builder --chown=nextjs:nodejs /app/node_modules/prisma ./node_modules/prisma
51-
COPY --from=builder --chown=nextjs:nodejs /app/node_modules/@prisma ./node_modules/@prisma
52-
COPY --from=builder --chown=nextjs:nodejs /app/node_modules/.prisma ./node_modules/.prisma
51+
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
5352

5453
# Entrypoint: migrate deploy → node server.js
5554
COPY --chown=nextjs:nodejs deploy/entrypoint.sh /app/entrypoint.sh

deploy/docker-compose.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ services:
2929
expose:
3030
- "3000"
3131
healthcheck:
32-
test: ["CMD", "wget", "-qO-", "http://localhost:3000/"]
32+
test:
33+
[
34+
"CMD-SHELL",
35+
"node -e \"fetch('http://127.0.0.1:3000/api/health').then((r) => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))\"",
36+
]
3337
interval: 30s
3438
timeout: 5s
3539
retries: 5

middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ export default auth((req) => {
4242

4343
export const config = {
4444
matcher: [
45-
"/((?!api/auth|_next/static|_next/image|favicon.ico|robots.txt|sitemap.xml|.*\\.(?:png|jpg|jpeg|gif|svg|webp|avif|ico)).*)",
45+
"/((?!api/auth|api/health|_next/static|_next/image|favicon.ico|robots.txt|sitemap.xml|.*\\.(?:png|jpg|jpeg|gif|svg|webp|avif|ico)).*)",
4646
],
4747
};

0 commit comments

Comments
 (0)