Skip to content

Reorganize Docker and build scripts out of project root #4710

Closed

Description

@objecttothis

Motivation

The project root currently contains a large number of Docker-related and build-related files: four docker-compose*.yml files, the Dockerfile, and three PowerShell build scripts (build.ps1, build-steps.ps1, build-package.ps1). This clutters the root directory alongside the application's core files (composer.json, package.json, spark, etc.) and makes it harder to see the project's actual structure at a glance.

This issue proposes moving these files into dedicated subdirectories — for example tools/Docker/ for the Docker-related files and tools/Build/ for the PowerShell scripts — while keeping everything fully functional.

Why this needs care

None of these files are hard-required to live in the root by the underlying tools, but several of them rely on root placement implicitly today, and moving them naively will break local development, deployment, or the build scripts:

  • docker compose up with no -f flag only auto-discovers a docker-compose.yml in the current working directory. INSTALL.md currently documents this bare command, so moving docker-compose.yml requires either updating the documented command to pass an explicit -f tools/Docker/docker-compose.yml, or providing a wrapper.
  • include: directives inside the compose files (docker-compose.yml includes docker/docker-mysql.yml; docker-compose.nginx.yml includes docker-compose.phpmyadmin.yml, which includes docker-compose.dev.yml) use paths relative to the including file's location. These will need to be updated to reflect the files' new locations.
  • Bind mounts and build context in docker-compose.dev.yml (build.context: ., volume .:/app) and in docker-compose.yml (source: ./.env) are resolved relative to the compose file's own directory, not the caller's working directory. After a move, these need to point back at the repository root (e.g. ../..), since the application still needs the full repo as the build context and the real root .env file.
  • docker build with no -f flag looks for ./Dockerfile inside the build context. If the Dockerfile moves, the dockerfile: key in docker-compose.dev.yml (or the docker build -f flag) must be updated explicitly. The build context itself must remain the repository root regardless, since the Dockerfile does COPY . /app.
  • PowerShell build scripts currently assume they're invoked with the repository root as the working directory (per their own header comments), and rely on that for relative composer install / npm install / npm run commands as well as a ../env/<folder-name>/.env restore step that depends on Get-Location being the repo root. If these scripts move into a subfolder, they should explicitly Set-Location back to the repository root (e.g. via $PSScriptRoot) at the top of the script, rather than relying on the caller's current directory.

Proposed approach

  1. Move the docker-compose files, Dockerfile, and the existing docker/ subfolder into a consolidated tools/Docker/ directory, adjusting all include: paths, context:/dockerfile: keys, and bind-mount sources accordingly so they resolve back to the repository root.
  2. Move build.ps1, build-steps.ps1, and build-package.ps1 into tools/Build/, adding an explicit working-directory change back to the repository root at the top of each script so they still work regardless of where they're invoked from.
  3. Update INSTALL.md, BUILD.md, and any other documentation referencing docker-compose up, docker build, or the build scripts to reflect the new paths.
  4. Verify end-to-end that docker compose -f tools/Docker/docker-compose.yml up, the dev/nginx/phpmyadmin compose variants, and each PowerShell script still work correctly from a clean checkout before merging.

The end goal is a cleaner project root with no change in behavior for anyone deploying via Docker or running the build scripts.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions