fix(DB): migrate the DB on container launch
This commit is contained in:
parent
011d10df29
commit
631906da35
2 changed files with 24 additions and 2 deletions
|
|
@ -25,11 +25,18 @@ COPY --from=builder /home/perplexica/.next/static ./public/_next/static
|
|||
COPY --from=builder /home/perplexica/.next/standalone ./
|
||||
COPY --from=builder /home/perplexica/data ./data
|
||||
|
||||
# Copy files needed for database migrations at runtime
|
||||
COPY drizzle.config.ts ./
|
||||
COPY src/lib/db/schema.ts ./src/lib/db/
|
||||
COPY docker-entrypoint.sh ./
|
||||
COPY package.json ./
|
||||
|
||||
RUN mkdir /home/perplexica/uploads && \
|
||||
chmod +x /home/perplexica/docker-entrypoint.sh && \
|
||||
npx -y playwright install chromium --with-deps && \
|
||||
npm install playwright && \
|
||||
npm install playwright drizzle-kit && \
|
||||
apt-get update && \
|
||||
apt-get install -y procps && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
CMD ["./docker-entrypoint.sh"]
|
||||
15
docker-entrypoint.sh
Normal file
15
docker-entrypoint.sh
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🚀 Starting Perplexica..."
|
||||
|
||||
# Ensure data directory exists
|
||||
mkdir -p /home/perplexica/data
|
||||
|
||||
# Run database schema migration
|
||||
echo "📊 Updating database schema..."
|
||||
npm run db:push
|
||||
|
||||
# Start the application
|
||||
echo "🌐 Starting Next.js server..."
|
||||
exec node server.js
|
||||
Loading…
Add table
Add a link
Reference in a new issue