FROM node:20-alpine # Install MinIO client (detect architecture) RUN ARCH=$(uname -m | sed 's/x86_64/amd64/g' | sed 's/aarch64/arm64/g') && \ wget https://dl.min.io/client/mc/release/linux-${ARCH}/mc && \ chmod +x mc && \ mv mc /usr/local/bin/ # Install development dependencies RUN apk add --no-cache bash # Create app directory WORKDIR /app # Copy package files COPY package*.json ./ # Install build tools for compilation (keep them in dev environment) RUN apk add --no-cache python3 make g++ # Install all dependencies (including devDependencies for development) # Make sure NODE_ENV is not set to production during install RUN NODE_ENV=development npm install && \ npm rebuild bcrypt --build-from-source # Create necessary directories RUN mkdir -p logs /tmp/minio-webui-temp && \ chmod 755 logs /tmp/minio-webui-temp # Copy application files COPY . . # Copy and run mc config initialization script COPY init-mc-config.sh /tmp/init-mc-config.sh RUN chmod +x /tmp/init-mc-config.sh && /tmp/init-mc-config.sh && rm /tmp/init-mc-config.sh # Change ownership of everything to node user (built-in) RUN chown -R node:node /app # Switch to non-root user USER node # Set development environment ENV NODE_ENV=development # Expose port EXPOSE 7510 # Start the application in development mode CMD ["npm", "run", "dev"]