diff --git a/backend/services/admin-service/Dockerfile b/backend/services/admin-service/Dockerfile index 09769b89..0194446c 100644 --- a/backend/services/admin-service/Dockerfile +++ b/backend/services/admin-service/Dockerfile @@ -43,8 +43,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ && rm -rf /var/lib/apt/lists/* -# Create app directory with correct ownership -RUN mkdir -p /app && chown nestjs:nodejs /app +# Create app directory and uploads directory with correct ownership +RUN mkdir -p /app /app/uploads && chown -R nestjs:nodejs /app WORKDIR /app # Switch to non-root user before installing dependencies @@ -61,6 +61,13 @@ RUN DATABASE_URL="postgresql://user:pass@localhost:5432/db" npx prisma generate # Copy built files COPY --chown=nestjs:nodejs --from=builder /app/dist ./dist +# Create uploads directory with correct ownership (before volume mount) +# This ensures the directory exists and has correct ownership +# Note: When a named volume is mounted, if it's empty, Docker will copy the container's directory content to it +USER root +RUN mkdir -p /app/uploads && chown -R nestjs:nodejs /app/uploads +USER nestjs + # Create startup script that runs migrations before starting the app RUN printf '%s\n' \ '#!/bin/sh' \