#!/bin/sh set -ex echo "Starting entrypoint script..." # Update apt repository, install git, and remove apt cache apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* echo "Git version: $(git --version)" PROJECT_DIR="/app/my-medusa-app" # Check if the Medusa project has already been created. if [ ! -d "$PROJECT_DIR" ]; then echo "Medusa project not found. Running installation..." # Run the Medusa CLI generator silently with the desired options: npx create-medusa-app@latest my-medusa-app \ --db-url "$DATABASE_URL" \ --no-browser \ --with-nextjs-starter # Change into the project folder, install dependencies and build the app. cd "$PROJECT_DIR" npm install npm run build else echo "Medusa project already exists. Skipping installation." fi # Change directory to the Medusa project folder. cd "$PROJECT_DIR" # List the contents of the project directory to verify installation. ls -la # Finally, start the Medusa server. echo "Starting Medusa server..." exec npm start