Fix Docker build and add first-run setup with docker-compose#257
Open
smxmdrissel wants to merge 3 commits intoLeeMangold:mainfrom
Open
Fix Docker build and add first-run setup with docker-compose#257smxmdrissel wants to merge 3 commits intoLeeMangold:mainfrom
smxmdrissel wants to merge 3 commits intoLeeMangold:mainfrom
Conversation
added 3 commits
February 26, 2026 14:58
…ow-module Remove developer-specific path repository pointing to /home/lmangold/projects/OGModules/WorkflowModule which caused 'composer install' to fail in Docker builds with: Source path not found for package opengrc/workflow-module Remove the path-type repository entry and the opengrc/workflow-module @dev require from composer.json, and clean the corresponding package entry and stability-flags from composer.lock.
Two issues prevented the container from starting correctly after 'docker compose up': 1. docker-entrypoint.sh used 'php artisan tinker' to check DB connectivity. This triggers AppServiceProvider::boot() before migrations have run, which aborts with 'OpenGRC was not installed properly' because the settings table does not yet exist. Replace with a direct PHP PDO check that bypasses the Laravel stack. 2. AppServiceProvider::boot() did not include artisan commands run during container initialisation (migrate, config:cache, route:cache, view:cache, db:seed, opengrc:create-user, settings:set, storage:link) in the installer bypass list, causing all of those commands to abort. Add the missing commands so the settings-table guard is skipped. Also add a first-run detection block in docker-entrypoint.sh that seeds the database and creates the admin user (using ADMIN_EMAIL / ADMIN_PASSWORD environment variables) when the users table is empty on startup.
Provides a ready-to-use Docker Compose configuration for running OpenGRC locally with MySQL 8.0. Starts two services: - db: MySQL 8.0 with a health check and a named persistent volume - app: OpenGRC on port 8080, waits for db to be healthy before starting Usage: docker build -t opengrc . docker compose up -d
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes several issues that prevented OpenGRC from building and running correctly with Docker, and adds a ready-to-use
docker-compose.ymlfor local development.Changes
Fix Docker build — remove local path dependency (
composer.json)Removes a developer-specific path repository pointing to
/home/lmangold/projects/OGModules/WorkflowModulethat causedcomposer installto fail in Docker builds with:Fix Docker container startup (
docker-entrypoint.sh,AppServiceProvider.php)Two issues prevented the container from starting correctly after
docker compose up:docker-entrypoint.shusedphp artisan tinkerto check DB connectivity. This triggersAppServiceProvider::boot()before migrations have run, aborting with "OpenGRC was not installed properly" because the settings table does not yet exist. Replaced with a direct PHP PDO check that bypasses the Laravel stack.AppServiceProvider::boot()did not include artisan commands run during container initialisation (migrate,config:cache,route:cache,view:cache,db:seed,opengrc:create-user,settings:set,storage:link) in the installer bypass list, causing all of those commands to abort. Added the missing commands so the settings-table guard is skipped during init.Add first-run database seeding (
docker-entrypoint.sh)Adds a first-run detection block that seeds the database and creates the admin user (using
ADMIN_EMAIL/ADMIN_PASSWORDenvironment variables) when the users table is empty on startup.Add
docker-compose.ymlfor local developmentProvides a ready-to-use Docker Compose configuration:
db: MySQL 8.0 with health check and named persistent volumeapp: OpenGRC on port 8080, waits for db to be healthyUsage:
docker build -t opengrc . docker compose up -dTesting
docker compose up -dstarts both services and performs first-run seedingMcpEndpointTestandStandardControlImplementationTestto reflect current behaviour