API extension error: Couldn't register endpoint "authentication"

I created an api extension which works well on local, but when I deploy my directus instance I run into this error

 WARN: EACCES: permission denied, mkdir 'extensions/.registry'
    err: {
      "type": "Error",
      "message": "EACCES: permission denied, mkdir 'extensions/.registry'",
      "stack":
          Error: EACCES: permission denied, mkdir 'extensions/.registry'
      "errno": -13,
      "code": "EACCES",
      "syscall": "mkdir",
      "path": "extensions/.registry"
    }

I updated my Dockerfile into a multi stage build . Stage 1: Build all the custom extensions then copy the built extensions into Directus extension Directory.

# --- Stage 1: Build all custom extensions
FROM node:22-alpine AS builder

WORKDIR /app

# Copy all extensions
COPY ./src/extensions ./extensions

# Enable Corepack and prepare pnpm
RUN corepack enable && corepack prepare pnpm@8.7.6 --activate

# Iterate and build all extensions
# Assumes each extension has its own package.json and build script
RUN for ext in /app/extensions/*; do \
    if [ -f "$ext/package.json" ]; then \
    echo "Building extension: $ext"; \
    cd "$ext" && pnpm install && pnpm build; \
    fi; \
    done


# Use the official Directus image as the base
FROM directus/directus:latest

# Switch to root to install dependencies and configure permissions
USER root

# Copy built extensions into the Directus extensions directory
COPY --from=builder /app/extensions /directus/extensions


# Enable Corepack and install pnpm, then set permissions for the Directus folder
RUN corepack enable \
    && corepack prepare pnpm@8.7.6 --activate \
    && chown node:node /directus



# Expose the Directus port
EXPOSE 8055

# Set environment variables for database configuration
# ENV DB_SSL__CA_FILE=/etc/ssl/certs/ca-certificate-muer-do-db.crt


# add a migration step before starting the server
USER node
CMD : \
    && node /directus/cli.js bootstrap \
    && node /directus/cli.js start;

on my docker-compose, I removed the volume mount of my extensions directory.

    volumes:
      # - ./src/extensions:/directus/extensions/
      - ./src/templates:/directus/templates/
    ports: