Update Dockerfile to add a new startup script and adjust permissions for entrypoint and startup scripts, simplifying the command execution process.
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m54s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m54s
This commit is contained in:
@@ -44,8 +44,9 @@ ENV PORT=3000
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
COPY docker-entrypoint.sh /entrypoint.sh
|
||||
COPY docker-start.sh /start.sh
|
||||
RUN apt-get update -y && apt-get install -y gosu && rm -rf /var/lib/apt/lists/* \
|
||||
&& chmod +x /entrypoint.sh
|
||||
&& chmod +x /entrypoint.sh /start.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["sh", "-c", "npx prisma migrate deploy && node server.js"]
|
||||
CMD ["/start.sh"]
|
||||
|
||||
15
docker-start.sh
Normal file
15
docker-start.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Run migrations; if P3005 (schema not empty, no migration history), baseline then retry
|
||||
if ! npx prisma migrate deploy 2>/dev/null; then
|
||||
echo "Migration failed, attempting baseline (P3005 fix)..."
|
||||
for dir in /app/prisma/migrations/*/; do
|
||||
[ -d "$dir" ] || continue
|
||||
name=$(basename "$dir")
|
||||
npx prisma migrate resolve --applied "$name" 2>/dev/null || true
|
||||
done
|
||||
npx prisma migrate deploy
|
||||
fi
|
||||
|
||||
exec node server.js
|
||||
Reference in New Issue
Block a user