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:
+14
-1
@@ -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" ]
|
||||
|
||||
Reference in New Issue
Block a user