Update Dockerfile to streamline database handling and remove entrypoint script: Change DATABASE_URL for development environment, enhance Prisma commands for migration and database push, and eliminate the custom entrypoint script for simplified application startup.
This commit is contained in:
25
Dockerfile
25
Dockerfile
@@ -19,8 +19,10 @@ RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
ENV DATABASE_URL="file:/tmp/build.db"
|
||||
RUN pnpm prisma generate
|
||||
ENV DATABASE_URL="file:/app/data/dev.db"
|
||||
RUN pnpm prisma generate && \
|
||||
pnpm prisma migrate deploy && \
|
||||
pnpm prisma db push
|
||||
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
RUN pnpm build
|
||||
@@ -47,29 +49,22 @@ 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"
|
||||
|
||||
# Installer seulement les dépendances de production puis générer Prisma Client
|
||||
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
|
||||
pnpm install --frozen-lockfile --prod && \
|
||||
pnpm dlx prisma generate
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
|
||||
ENV DATABASE_URL="file:/app/data/dev.db"
|
||||
|
||||
# Nettoyer les dépendances de développement
|
||||
RUN pnpm prune --prod
|
||||
|
||||
|
||||
# Create data directory for SQLite database and uploads directories
|
||||
RUN mkdir -p /app/data /app/public/uploads /app/public/uploads/backgrounds && \
|
||||
chown -R nextjs:nodejs /app/data /app/public/uploads
|
||||
|
||||
COPY --chown=nextjs:nodejs scripts/docker-entrypoint.sh /app/entrypoint.sh
|
||||
RUN chmod +x /app/entrypoint.sh
|
||||
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 3000
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
ENV DATABASE_URL="file:/app/data/dev.db"
|
||||
|
||||
ENTRYPOINT ["./entrypoint.sh"]
|
||||
ENTRYPOINT ["pnpm", "start"]
|
||||
|
||||
Reference in New Issue
Block a user