JavaScript - Node.js + Next.js
Node.js is a framework for the JavaScript language that allows you to create a web application using only this language, running JavaScript on the server side instead of in the browser. It is compatible with all other JavaScript frameworks, as well as its own plugins and extensions.
Next.js is a framework for Node.js that allows designing front-end by facilitating the connection of the graphical interface with JavaScript code. It is the most recommended framework for building user interfaces in a Node.js application, highly optimized and SEO-friendly.
Project structure
.
βββ app
βΒ Β βββ dev.Dockerfile
βΒ Β βββ next.config.js
βΒ Β βββ package.json
βΒ Β βββ prod.Dockerfile
βΒ Β βββ prod-without-multistage.Dockerfile
βΒ Β βββ public
βΒ Β βΒ Β βββ favicon.ico
βΒ Β βΒ Β βββ vercel.svg
βΒ Β βββ src
βΒ Β βΒ Β βββ pages
βΒ Β βΒ Β βΒ Β βββ _app.tsx
βΒ Β βΒ Β βΒ Β βββ index.tsx
βΒ Β βΒ Β βββ styles
βΒ Β βΒ Β βββ globals.css
βΒ Β βΒ Β βββ Home.module.css
βΒ Β βββ tsconfig.json
βββ app.Dockerfile
βββ compose.yaml
βββ README.txt
Application deployment:
Change to the directory that contains the files needed to build the container:
cd /root/stack/python/nextjs
Then start the application:
docker compose up -d
Useful commands:
View running containers:
docker compose ps
Stop and remove the application:
docker compose down
Rebuild the application after making code changes:
docker compose --build -d