diff --git a/DOCKER_GIT_DEPLOYMENT.md b/DOCKER_GIT_DEPLOYMENT.md index b7e1ac6..7a9f9f8 100644 --- a/DOCKER_GIT_DEPLOYMENT.md +++ b/DOCKER_GIT_DEPLOYMENT.md @@ -132,13 +132,39 @@ When `GIT_REPO_URL` is provided: 2. If `GIT_COMMIT` is specified, checkout that specific commit 3. Install dependencies from the repository's package.json 4. Build the application -5. Start the production server +5. **Create the default admin account automatically** +6. Start the production server When `GIT_REPO_URL` is not provided: 1. Copy local files into the container 2. Install dependencies 3. Build the application -4. Start the production server +4. **Create the default admin account automatically** +5. Start the production server + +## Default Admin Account + +The Docker build process automatically creates a default admin account with these credentials: + +- **Email**: `admin@localhost.com` +- **Password**: `admin123456` +- **Role**: `admin` + +⚠️ **Important Security Note**: Please change the default password immediately after your first login! + +### Manual Admin Account Creation + +If you need to create the admin account manually (for development or testing): + +```bash +# Using npm script +npm run create-admin + +# Or directly +node scripts/create-admin.js +``` + +The script will skip creation if an admin account already exists. ## Environment Variables @@ -163,3 +189,9 @@ When `GIT_REPO_URL` is not provided: ### Permission Issues - Ensure the Docker daemon has network access - For private repositories, verify authentication tokens/keys + +### Admin Account Issues +- If admin creation fails during build, check database initialization +- Ensure the database file is writable in the container +- If admin already exists, the script will skip creation (this is normal) +- To recreate admin account, delete the database and rebuild the container diff --git a/Dockerfile b/Dockerfile index ade93f6..504f3f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,6 +32,9 @@ COPY . . # Build the application for production RUN npm run build +# Create the default admin account +RUN node scripts/create-admin.js + # Expose the default Next.js port EXPOSE 3000