feat: add startup migration script and improve Docker setup

- Add scripts/start.ts to run drizzle migrations before server start
- Update Dockerfile to copy migration files and install prod deps
- Change entrypoint to use migration-aware startup script
- Add deployment documentation
This commit is contained in:
Zoe
2026-05-11 17:43:13 -05:00
parent a1aeed51e2
commit 30a425744d
3 changed files with 227 additions and 1 deletions
+14 -1
View File
@@ -20,6 +20,19 @@ WORKDIR /app
# Only `.output` folder is needed from the build stage
COPY --from=build /app/.output /app
# Copy migration SQL files for runtime migrations
COPY --from=build /app/drizzle/migrations /app/drizzle/migrations
# Copy entrypoint script
COPY --from=build /app/scripts/start.ts /app/scripts/start.ts
# Copy package.json and lockfile for production dependency install
COPY --from=build /app/package.json /app/package.json
COPY --from=build /app/bun.lock* ./
# Install production dependencies only (drizzle-orm, pg, etc.)
RUN bun install --frozen-lockfile --production --ignore-scripts
# run the app
EXPOSE 3000/tcp
ENTRYPOINT [ "bun", "--bun", "run", "/app/server/index.mjs" ]
ENTRYPOINT [ "bun", "run", "/app/scripts/start.ts" ]