A custom ERPNext Docker image build configuration that includes multiple Frappe applications for extended functionality with optimized build performance.
This project builds a custom ERPNext Docker image with the following applications:
- Frappe (core framework) - version-16
- ERPNext - version-16
- HRMS - Human Resource Management System - version-16
- Builder - Website and page builder - master branch
- CRM - Customer Relationship Management - main branch
- Helpdesk - Ticketing and support system - main branch
- Telephony - Telephony integration - develop branch
- Mail - Email management - develop branch
The image is built using GitHub Actions with performance optimizations and published to Docker Hub as mitexleo/syserp.
- Automated Builds: GitHub Actions workflow that builds and deploys images automatically
- Build Optimizations: Docker BuildKit, layer caching, and automatic cleanup for smaller images and faster builds
- Version Management: Automatic semantic versioning for Docker images
- Scheduled Updates: Automated builds every 6 hours to check for new releases
- Multi-App Integration: Seamlessly integrates multiple Frappe applications
- Release Monitoring: Automatically detects new releases from all included repositories
The build process includes several optimizations for reduced image size and faster builds:
- Cache Cleanup: Removes pip, npm, and package manager caches
- Bytecode Removal: Deletes Python
.pycfiles and__pycache__directories - Source Map Removal: Removes frontend source map files (
.map) - Expected Reduction: 200-500MB smaller images
- Docker BuildKit: Enabled for advanced build features and better caching
- Registry & Inline Caching: Uses Docker registry cache and inline cache for efficient layer reuse between builds
- BuildKit Optimization: Advanced build features for faster builds and smaller images
- Expected Speedup: 30-50% faster builds using registry cache and inline caching
The built images are available on Docker Hub:
- Repository:
mitexleo/syserp - Tags:
latest(most recent build) and semantic versions (e.g.,1.0.0,1.0.1) - Base: Built on Frappe version-16 framework
- Optimized: Includes build optimizations for smaller size and faster deployment
The apps.json file defines which Frappe applications are included in the build:
[
{
"url": "https://github.com/frappe/erpnext",
"branch": "version-16"
},
{
"url": "https://github.com/frappe/hrms",
"branch": "version-16"
},
{
"url": "https://github.com/frappe/builder",
"branch": "master"
},
{
"url": "https://github.com/frappe/crm",
"branch": "main"
},
{
"url": "https://github.com/frappe/helpdesk",
"branch": "main"
},
{
"url": "https://github.com/frappe/telephony",
"branch": "develop"
},
{
"url": "https://github.com/frappe/mail",
"branch": "develop"
}
]To add a new Frappe application, follow these steps:
-
Edit
apps.jsonand add your app configuration:{ "url": "https://github.com/your-username/your-app", "branch": "main" } -
Commit and push your changes
The GitHub Actions workflow will automatically build a new image with your app included. The workflow checks for new releases every 6 hours and updates the image accordingly.
The build workflow runs automatically:
- Scheduled: Every 6 hours (checks for new releases)
- Manual: Via GitHub Actions workflow dispatch (force build option)
The system automatically:
- Checks for new releases from all monitored repositories
- Increments the patch version (e.g., 1.0.0 → 1.0.1) when changes are detected
- Tags the new image with both the new version and
latest - Updates
REPO_VERSIONS.jsonwith the latest release tags
During each build:
- BuildKit Setup: Configures Docker Buildx for advanced features
- Registry Caching: Pulls cache from previous image in Docker registry
- Containerfile Patching: Adds cleanup commands to remove unnecessary files
- Optimized Build: Uses BuildKit with inline and registry cache for faster builds
- Docker and Docker Compose
- GitHub account with repository access
- Docker Hub account for image registry
jqandcurlfor local testing
-
Clone the repository:
git clone https://github.com/mitexleo/ERPNext cd ERPNext -
Modify
apps.jsonas needed -
Test the build locally:
# Clone frappe_docker git clone https://github.com/frappe/frappe_docker # Build the image cd frappe_docker APPS_JSON_BASE64=$(base64 -w 0 ../apps.json) docker build \ --build-arg=FRAPPE_PATH=https://github.com/frappe/frappe \ --build-arg=FRAPPE_BRANCH=version-16 \ --build-arg=APPS_JSON_BASE64=$APPS_JSON_BASE64 \ --tag=local-erpnext:test \ --file=images/layered/Containerfile . # Run the container docker run -d -p 8000:8000 local-erpnext:test
Configure the following secrets in your GitHub repository:
DOCKER_USERNAME: Your Docker Hub usernameDOCKER_PASSWORD: Your Docker Hub password or access tokenGITHUB_TOKEN: Your GitHub token for repository access
- Build Failures: Check that all apps in
apps.jsonare accessible and branches exist. Ensurejqandcurlare installed. - Version Conflicts: Ensure all apps are compatible with Frappe version-16.
- Docker Hub Permissions: Verify Docker Hub credentials are correctly set in GitHub secrets.
- GitHub Token: Ensure the GitHub token has the necessary permissions for repository access.
- Release Detection: Check
REPO_VERSIONS.jsonto see which releases are being tracked. - Cache Issues: If builds are slow, the Docker layer cache may need to be cleared.
- First Build: May be slower as it builds the cache
- Subsequent Builds: Should be significantly faster with cached layers
- Cache Persistence: Cache persists between workflow runs for 7 days
- Manual Cache Clear: Delete the GitHub Actions cache if encountering issues
View container logs:
docker logs <container-name>View build logs in GitHub Actions for detailed build information and optimization status.
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes to
apps.jsonor workflow files - Commit your changes:
git commit -am 'Add new feature' - Push to the branch:
git push origin feature/your-feature - Create a Pull Request
This project configuration is open source. Individual applications included may have their own licenses.
For issues related to:
- This build configuration: Create an issue in this repository
- ERPNext functionality: Visit ERPNext Community
- Individual apps: Refer to their respective repositories
- Build optimizations: Check
.github/workflows/build.ymlfor configuration details - Docker issues: Review Docker Hub repository logs