Enhance Dockerfile by adding scripts directory and updating entrypoint script: Copy scripts to the container and set permissions for the new entrypoint script, improving application startup and migration handling.
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m58s

This commit is contained in:
Julien Froidefond
2025-12-15 17:41:32 +01:00
parent d9555a5d49
commit 5e179fb97a
2 changed files with 61 additions and 9 deletions

View File

@@ -47,6 +47,7 @@ COPY --from=builder /app/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=builder /app/next.config.js ./next.config.js
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
COPY --from=builder /app/scripts ./scripts
ENV DATABASE_URL="file:/tmp/build.db"
@@ -61,15 +62,8 @@ ENV DATABASE_URL="file:/app/data/dev.db"
RUN mkdir -p /app/data /app/public/uploads /app/public/uploads/backgrounds && \
chown -R nextjs:nodejs /app/data /app/public/uploads
RUN echo '#!/bin/sh' > /app/entrypoint.sh && \
echo 'set -e' >> /app/entrypoint.sh && \
echo 'mkdir -p /app/data' >> /app/entrypoint.sh && \
echo 'mkdir -p /app/public/uploads' >> /app/entrypoint.sh && \
echo 'mkdir -p /app/public/uploads/backgrounds' >> /app/entrypoint.sh && \
echo 'pnpm dlx prisma migrate deploy || true' >> /app/entrypoint.sh && \
echo 'exec pnpm start' >> /app/entrypoint.sh && \
chmod +x /app/entrypoint.sh && \
chown nextjs:nodejs /app/entrypoint.sh
COPY --chown=nextjs:nodejs scripts/docker-entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
USER nextjs