Is there an existing issue for this?
Feature Description
Currently, the Dockerfile in the repository is set up primarily for development. It labels itself as a builder but copies all source code and runs npm run dev directly. This results in a very large Docker image that includes dev dependencies and source files.
I would like to implement a true multi-stage Docker build:
- Stage 1 (Builder): Use the Node.js image to install dependencies (
npm ci) and build the Docusaurus static files (npm run build).
- Stage 2 (Production): Use a lightweight web server image (
nginx:alpine), copy only the compiled static files from the builder stage, and serve them.
Additionally, I will update the docker-compose.yml to explicitly target the builder stage so that local development with hot-reloading (npm run dev) continues to work seamlessly.
Use Case
This feature enhances the project infrastructure by making it production-ready. Anyone looking to deploy the recode-website to a cloud provider (like AWS, DigitalOcean, or Azure) using Docker will benefit from a highly optimized, fast, and secure image.
Benefits
- Massive Reduction in Image Size: By dropping the source code and
node_modules from the final image, the container size will drop significantly.
- Better Security: The final container will only contain static files and an Nginx server, eliminating Node.js runtime vulnerabilities in production.
- Improved Performance: Serving static files via Nginx is much faster and more efficient than running a Node.js development server (
npm run dev) in production.
Add ScreenShots
No response
Priority
High
Record
Is there an existing issue for this?
Feature Description
Currently, the
Dockerfilein the repository is set up primarily for development. It labels itself as a builder but copies all source code and runsnpm run devdirectly. This results in a very large Docker image that includes dev dependencies and source files.I would like to implement a true multi-stage Docker build:
npm ci) and build the Docusaurus static files (npm run build).nginx:alpine), copy only the compiled static files from the builder stage, and serve them.Additionally, I will update the
docker-compose.ymlto explicitly target thebuilderstage so that local development with hot-reloading (npm run dev) continues to work seamlessly.Use Case
This feature enhances the project infrastructure by making it production-ready. Anyone looking to deploy the recode-website to a cloud provider (like AWS, DigitalOcean, or Azure) using Docker will benefit from a highly optimized, fast, and secure image.
Benefits
node_modulesfrom the final image, the container size will drop significantly.npm run dev) in production.Add ScreenShots
No response
Priority
High
Record