feat: Automatically create default admin account during Docker build process

This commit is contained in:
2025-07-28 21:48:28 +02:00
parent c767e65819
commit aada481c0a
2 changed files with 37 additions and 2 deletions

View File

@@ -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