feat: run migrations via entrypoint
This commit is contained in:
@@ -75,6 +75,5 @@ ARG PORT=3000
|
|||||||
ENV PORT=${PORT}
|
ENV PORT=${PORT}
|
||||||
EXPOSE ${PORT}
|
EXPOSE ${PORT}
|
||||||
|
|
||||||
# Run migration on start for now (until we have a better way to handle this)
|
CMD ["./entrypoint.sh"]
|
||||||
CMD ["sh", "-c", "cd /app && pnpm db:migrate && cd /app/apps/web && pnpm start"]
|
|
||||||
|
|
||||||
|
|||||||
16
apps/web/entrypoint.sh
Normal file
16
apps/web/entrypoint.sh
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Run migrations from the Turborepo root context
|
||||||
|
echo "Running database migrations..."
|
||||||
|
# Navigate to the Turborepo root to run the db:migrate command
|
||||||
|
pnpm --prefix /app db:migrate
|
||||||
|
|
||||||
|
# Check if migration was successful
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "\nDatabase migration failed! Exiting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "\nStarting Next.js application..."
|
||||||
|
# Start the Next.js application from the web app's directory
|
||||||
|
exec node .next/standalone/apps/web/server.js
|
||||||
@@ -10,6 +10,7 @@ configureRuntimeEnv();
|
|||||||
|
|
||||||
/** @type {import("next").NextConfig} */
|
/** @type {import("next").NextConfig} */
|
||||||
const config = {
|
const config = {
|
||||||
|
output: "standalone",
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
|
|
||||||
/** Enables hot reloading for local packages without a build step */
|
/** Enables hot reloading for local packages without a build step */
|
||||||
|
|||||||
Reference in New Issue
Block a user