Lixil Grohe Campaign Pages (NextJS)
Introduction
We have developed campaign and catalogue pages for Lixil using Next.js
and deployed them to a DigitalOcean droplet using Docker
.
Setting Up for Development
Clone the repository using the following command:
git clone https://github.com/extension-technologies/lixil-grohe-next-app.git
Open the directory of the cloned repository:
cd lixil-grohe-next-app/
Install all required dependencies using the following command (Yarn is used as the package manager in this project):
yarn install
Now run the following command to start the development server of the application:
yarn run dev
The output should resemble the following:
yarn run v1.22.21 warning ../package.json: No license field $ next dev ready - started server on 0.0.0.0:3000, url: http://localhost:3000 Browserslist: caniuse-lite is outdated. Please run: npx browserslist@latest --update-db Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating event - compiled client and server successfully in 5.7s (768 modules)
The development server is now running at port 3000 of localhost. Open the following URL in your browser: http://localhost:3000
Deployment of Application
Docker is utilized for deploying this application.
Dockerfile
In the current project, we have a Dockerfile used to create a Docker image of the application.
Push the latest code to Git:
Firstly, commit all the latest changes and push them to GitHub.
Now, open the server (DigitalOcean droplet) where the application is hosted:
ssh root@64.227.157.187
pwd:extensioN@12tech
or use the droplet console button in DigitalOcean.
Open the directory of the project/application:
cd lixil-grohe-next-app/
Pull the latest code from Git using the following command:
git pull origin main
This command pulls all the latest changes from Git to the server.
Now, run the following command to build a new Docker image and set up the latest container with the current image:
a. Build the latest image:
docker build -t lixilpages .
b. Remove the running container:
docker rm lixil --force
c. Now, run the latest container on port 3000:
docker run -it -d -p 3000:3000 --name lixil lixilpages
OR
Run the entire command as follows:
docker build -t lixilpages . && docker rm lixil --force && docker run -it -d -p 3000:3000 --name lixil lixilpages
This will create a new container with the latest changes.
β Safe Cleanup Script for Live Server
Hereβs a safe, ready-to-use one-liner that will free up space without affecting the running container:
bash
CopyEdit
docker system prune --volumes -f && find /var/log -type f -name "*.log" -exec truncate -s 0 {} \; && apt-get clean && rm -rf /var/lib/apt/lists/*
π What this does:
β
docker system prune --volumes -f
β removes:Stopped containers
Dangling images/volumes
Unused networks
β Truncates large
.log
filesβ Cleans APT cache