A Docker environment generator for Next.js.
The main idea behind this tool is to have an automatic way to generate Next.js environments for development, but also for production. To support this, Traefik has been included to the tech stack, enabling SSL termination and simplifying the generation of SSL certificates for live sites.
Note
It will continue improving to add other relevant services to the tech stack like SMTP, database, etc. They will be ready to use to facilitate the release of complex apps/developments.
Before using this tool, ensure that you have:
-
User with
sudoprivileges. -
Git installed on your system.
Note
It is required a user with sudo privileges to install required dependencies (check this and this), but also to update the /etc/hosts file with local domain that will be used for development.
To install this tool, run the following command:
git clone https://github.com/d3p1/docknext.git && \
chmod +x docknext/src/bin/setup/installer.sh && \
./docknext/src/bin/setup/installer.sh && \
source ~/.bash_profile && \
rm -rf docknext/Using this tool is straightforward:
-
Create a
.docknext_profilefile. This file lets you configure environment variables that define how the project environment should be generated. -
Execute
docknext initto generate the necessary Docker Compose files for the project. -
Execute
docknext next-installif you want to install a new Next.js platform to work with the current generated environment. -
Execute
docknext next-configureto configure the Next.js project. This will execute a final setup so the existing Next.js project is ready to work with the generated environment. -
Execute
docknext ide-configureto simplify the configuration of your IDE, allowing you to work with this generated environment efficiently and effectively. -
Finally, execute
docker compose up -dto start the generated environment.
Note
A recommended release approach could be:
- In your local/CI environment, pull latest code from the repository.
- Build the
webimage. - Push
webimage to the registry. - In your production environment, execute
docker compose up -d. Because thepull_policyis set toalwaysfor thewebservice, the latest image will be pulled and used.
Note
If you use GitHub Actions to automate your development and delivery workflow, you can use the d3p1/semantic-releasify action to publish the web image on every release.
Important
The Next.js project must live in a child directory of the directory where the docknext init is executed. This is because Docker only can access build context from the directory where the docker-compose.yml file is located, and the production image must copy the app source code to then build it and start the app.
Additioanlly, the docknext ide-configure for WebStorm considers that the source code lives in a child directory to configure the startup script.
Important
For now, docknext ide-configure only installs startup scripts that are very useful for WebStorm. However, automating the configuration of other important aspects and supporting additional IDEs is still pending. This ticket will handle the completion of this requirement.
Note
To gain a deeper understanding of how this tool works under the hood, visit the wiki page (currently, in progress).
Note
If you encounter issues while using this tool, refer to the troubleshooting page for guidance (currently, in progress).
Important
Please note that as of now, this tool has only been tested on Debian 12 and requires an environment with bash to function correctly.
Warning
Currently, this environment only works with node 22.21 and bun 1.3. It will be improved the supported versions provided by our custom image.
Detailed changes for each release are documented in CHANGELOG.md.
This work is published under MIT License.
Always happy to receive a greeting on: