Skip to content

d3p1/docknext

[DOCKNEXT]

semantic-release: angular Release

Introduction

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.

Prerequisites

Before using this tool, ensure that you have:

  • User with sudo privileges.

  • 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.

Installation

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/

Usage

Using this tool is straightforward:

  1. Create a .docknext_profile file. This file lets you configure environment variables that define how the project environment should be generated.

  2. Execute docknext init to generate the necessary Docker Compose files for the project.

  3. Execute docknext next-install if you want to install a new Next.js platform to work with the current generated environment.

  4. Execute docknext next-configure to 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.

  5. Execute docknext ide-configure to simplify the configuration of your IDE, allowing you to work with this generated environment efficiently and effectively.

  6. Finally, execute docker compose up -d to start the generated environment.

Note

A recommended release approach could be:

  1. In your local/CI environment, pull latest code from the repository.
  2. Build the web image.
  3. Push web image to the registry.
  4. In your production environment, execute docker compose up -d. Because the pull_policy is set to always for the web service, 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.

Changelog

Detailed changes for each release are documented in CHANGELOG.md.

License

This work is published under MIT License.

Author

Always happy to receive a greeting on:

About

A Docker environment generator for Next.js

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 2

  •  
  •