refactor: Consolidate to single universal Dockerfile with BUILD_ENV argument #569
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 simplifies Docker configuration to a single universal Dockerfile controlled by a simple
BUILD_ENVbuild argument. No more multi-stage targets, no more separate files - just one Dockerfile that switches between development and production modes.Problem
Previously, we had:
Dockerfile(~160 lines) - Production multi-stage buildDockerfile.dev(~47 lines) - Development single-stageDockerfile.unified(176 lines) - Multi-target approach withdevelopmentandproductiontargetsAll of this was overly complex for what should be a simple environment switch.
Solution
Created a single universal
Dockerfile(110 lines) controlled by:BUILD_ENV=production(default) - Installs nginx, builds assets, serves on port 80BUILD_ENV=development- Skips nginx, runs dev server on port 3000Changes
Added:
Dockerfilewith conditional logicModified:
docker-compose.yaml- UsesBUILD_ENVarg instead of targets.dockerignore- Removed specific Dockerfile references.github/workflows/docker-validate.yml- Lints new DockerfileREADME.md- Simplified Docker documentationRemoved:
Dockerfile.unified(multi-target approach)Dockerfile.dev(old development-only)Dockerfilereplaced with universal versionBenefits
BUILD_ENV)--build-arg BUILD_ENV=<mode>Architecture
Usage
Docker Compose (Recommended)
Direct Docker Build
Testing
Ready for review and testing!