Claude's suggestion for Dockerfile migration
This commit is contained in:
parent
e464a24a4b
commit
fd8348b284
23
Dockerfile
23
Dockerfile
@ -33,6 +33,15 @@ RUN pnpm install
|
|||||||
COPY --from=builder /app/out/full/ .
|
COPY --from=builder /app/out/full/ .
|
||||||
RUN pnpm turbo run build
|
RUN pnpm turbo run build
|
||||||
|
|
||||||
|
# Add between build and runner stages:
|
||||||
|
FROM installer AS migrator
|
||||||
|
WORKDIR /app
|
||||||
|
# Copy migration files
|
||||||
|
COPY --from=installer /app/packages/db/migrations ./packages/db/migrations
|
||||||
|
COPY --from=installer /app/packages/db/migrate.ts ./packages/db/migrate.ts
|
||||||
|
# Run migrations
|
||||||
|
RUN node -r esbuild-register packages/db/migrate.ts
|
||||||
|
|
||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
@ -48,13 +57,15 @@ COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/standalone ./
|
|||||||
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static
|
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static
|
||||||
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public
|
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public
|
||||||
|
|
||||||
# Handle db migrations
|
# # Handle db migrations
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/package.json ./package.json
|
# COPY --from=builder --chown=nextjs:nodejs /app/package.json ./package.json
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/packages/db ./packages/db
|
# COPY --from=builder --chown=nextjs:nodejs /app/packages/db ./packages/db
|
||||||
|
|
||||||
|
# RUN ["pnpm", "--filter=@lifetracker/db", "install"]
|
||||||
|
# RUN ["pnpm", "--filter=@lifetracker/db", "generate"]
|
||||||
|
# RUN ["pnpm", "--filter=@lifetracker/db", "migrate"]
|
||||||
|
|
||||||
|
|
||||||
RUN ["pnpm", "--filter=@lifetracker/db", "install"]
|
|
||||||
RUN ["pnpm", "--filter=@lifetracker/db", "generate"]
|
|
||||||
RUN ["pnpm", "--filter=@lifetracker/db", "migrate"]
|
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
CMD node apps/web/server.js
|
CMD node apps/web/server.js
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user