This PR introduces Docker support to our project, allowing developers to easily set up and tear down their development environments. We've added a Dockerfile that describes the containerized environment for our Next.js application and a docker-compose.yml file that simplifies the management of our Docker container.
Reason for Change:
Introducing Docker to our project streamlines the setup process for new developers and ensures a consistent development environment across all machines. This reduces the "it works on my machine" issues and ensures that everyone is working in a similar environment. Additionally, Docker provides an added layer of isolation, making it easier to manage dependencies and configurations.
Tested:
The Docker image builds successfully without errors.
The Next.js application runs as expected when using docker-compose up.
Changes made to the source code on the host machine are reflected in real-time inside the container, thanks to the volume mount.
The application is accessible via http://localhost:3000 in a web browser.
The container can be stopped gracefully using docker-compose down.
How to use the new Docker setup:
Building and Starting the Container:
Navigate to the project directory and run:
docker-compose up
This command does the following:
Builds the Docker image based on the provided Dockerfile (if not already built).
Starts a container instance of the image.
Maps port 3000 of the host machine to port 3000 of the container.
Mounts the current directory on the host machine to the /app directory in the container, ensuring real-time reflection of changes.
Once the command is executed, the Next.js application will start, and you can access it in your browser at http://localhost:3000.
Stopping the Container:
To stop the running container and remove it, simply run:
docker-compose down
This command stops the container and removes it, ensuring a clean environment for the next time you run docker-compose up.
Overall Review of Changes:
This PR introduces Docker support to our project, allowing developers to easily set up and tear down their development environments. We've added a
Dockerfile
that describes the containerized environment for our Next.js application and adocker-compose.yml
file that simplifies the management of our Docker container.Reason for Change:
Introducing Docker to our project streamlines the setup process for new developers and ensures a consistent development environment across all machines. This reduces the "it works on my machine" issues and ensures that everyone is working in a similar environment. Additionally, Docker provides an added layer of isolation, making it easier to manage dependencies and configurations.
Tested:
docker-compose up
.http://localhost:3000
in a web browser.docker-compose down
.How to use the new Docker setup:
Building and Starting the Container:
Navigate to the project directory and run:
This command does the following:
Dockerfile
(if not already built)./app
directory in the container, ensuring real-time reflection of changes.Once the command is executed, the Next.js application will start, and you can access it in your browser at
http://localhost:3000
.Stopping the Container:
To stop the running container and remove it, simply run:
This command stops the container and removes it, ensuring a clean environment for the next time you run
docker-compose up
.