chore: consolidate docker scripts into single docker-compose with profiles#15974
Conversation
| - DATA_DIR=/tmp/localstack/data | ||
| volumes: | ||
| - './.localstack:/var/lib/localstack' | ||
| - localstack_data:/var/lib/localstack |
There was a problem hiding this comment.
Changed to a named volume so down -v cleanly removes all data without leaving a .localstack directory in the repo
| "docker:restart": "pnpm docker:stop --remove-orphans && pnpm docker:start", | ||
| "docker:start": "docker compose -f test/docker-compose.yml up -d", | ||
| "docker:stop": "docker compose -f test/docker-compose.yml down", | ||
| "docker:start": "docker compose -f test/docker-compose.yml --profile all down -v --remove-orphans 2>/dev/null; docker compose -f test/docker-compose.yml --profile all up -d --wait", |
There was a problem hiding this comment.
Every start is intentionally a clean start. The -v flag removes volumes (database data), so you always get a fresh environment. This is why we don't need separate restart, restart:clean, or start:clean scripts anymore. This command should be worry-free, always works, all you need
| - '27018:27017' | ||
| volumes: | ||
| - mongodb_data:/data/db | ||
| - mongodb_configdb:/data/configdb |
There was a problem hiding this comment.
This line is new. Everything else is copied from the old separate docker-compose files.
Docker creates anonymous volumes with hash names that aren't cleaned up by down -v and clutter the volumes list. Mapping to named volumes keeps everything under payload-monorepo_*
Volumes before this line:
Volumes after:
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
denolfe
left a comment
There was a problem hiding this comment.
Looks good, thanks for the self-review comments. I triggered re-running the test flakes.
|
🚀 This is included in version v3.80.0 |
Replaces 18 docker scripts and 4 separate docker-compose files with 3 scripts and 1 unified compose file using Docker Compose profiles.
The goal is one single command that covers 99% of cases:
pnpm docker:start. Running it gives you all services started clean, with no leftover data from previous runs. No more looking throughpackage.jsonfor the rightdocker:mongodb:startordocker:postgres:restart:clean- just one command.Docker Compose starts all services in parallel, so there's no performance overhead compared to the old targeted commands. All services are defined in
test/docker-compose.ymlwith profiles (postgres,mongodb,mongodb-atlas,storage,all). CI uses individual profiles to start only what it needs.All services (PostgreSQL, MongoDB, mongot, MongoDB Atlas Local, LocalStack, Azure Storage, GCS) now show grouped under a single
payload-monorepoproject in Docker Desktop / Orbstack, as seen in the screenshot:Containers Before
Containers After
Volumes Before
Volumes After
(More volumes, because we now have more named volumes instead of just directories in the payload monorepo)