Skip to content

fab-uleuh/next.js-deploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

next.js-deploy

This project describes how to deploy a Next.js application using Docker and Nginx Proxy Manager.

It is linked to the following YouTube videos:

Fast Version ⚡

Long Version 🐢

Readme fr 🇫🇷

Prerequisites

Before starting, make sure you have Docker and Docker Compose installed on your machine. You can follow the official instructions to install Docker on Ubuntu here:

Install Docker on Ubuntu

Documentation

Deployment Steps

1. Create a Docker Network for Nginx

This command creates a Docker network named nginx that will be used to connect the containers.

sudo docker network create nginx

2. Build the Docker Image for the Next.js Application

Use the following command to build the Docker image from the Dockerfile in the current directory. The -t nextjs-docker option assigns a name to the Docker image.

docker build -t nextjs-docker .

3. Start the Services with Docker Compose

This command starts the services defined in the docker-compose.yml file in detached mode (in the background).

sudo docker compose up -d

4. Recreate the Services with Docker Compose

If you need to recreate the containers (e.g., after modifying the configuration), use the --force-recreate option.

sudo docker compose up -d --force-recreate

5. Access the Nginx Proxy Manager Container

To access a specific container, use docker exec with the -it option to open an interactive session in the nginx-proxy-manager-app-1 container.

sudo docker exec -it nginx-proxy-manager-app-1 bash

Nginx Static HTML Export Configuration

Add the following configuration to define the site location. This configuration tells Nginx to serve the content from the /site/app-3 directory at the root of the URL.

location / {
  root /site/app-3;
}

Additional Notes

  • Make sure to replace /site/app-3 with the correct path to the directory where your application is deployed.
  • Check the container names and configurations specific to your deployment environment.

Conclusion

By following these steps, you should be able to deploy your Next.js application using Docker and Nginx Proxy Manager. Feel free to consult the linked documentation for more details and advanced configuration.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published