auto-run drizzle migrations on container startup

This commit is contained in:
2026-02-24 22:47:28 -05:00
parent ae9f081f90
commit 301e66f19f
2 changed files with 6 additions and 1 deletions

View File

@@ -5,7 +5,9 @@ RUN bun install --frozen-lockfile
FROM deps AS builder
ARG NEXT_PUBLIC_API_URL=
ARG DATABASE_URL=postgres://postgres:postgres@localhost:5432/fiscal_clone
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
ENV DATABASE_URL=${DATABASE_URL}
ENV NEXT_TELEMETRY_DISABLED=1
COPY . .
RUN mkdir -p public && bun run build
@@ -21,10 +23,12 @@ ENV NEXT_TELEMETRY_DISABLED=1
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/drizzle ./drizzle
COPY --from=builder /app/drizzle.config.ts ./drizzle.config.ts
RUN mkdir -p /app/data
EXPOSE 3000
ENV PORT=3000
CMD ["bun", "server.js"]
CMD ["sh", "-c", "bun x drizzle-kit migrate && bun server.js"]