The website is fully dockerized you can run it with or without Docker
Requirements:
- node
1- Install dependencies
cd portfolio && yarn
2- Run server
cd portfolio && yarn dev
Requirements:
- Docker
- Docker compose
1- launch with docker compose
- cd portfolio && docker-compose up -d
cd portfolio # <---- change to main directory
yarn build # <---- build website assets
yarn start # <--- serve website
cd portfolio # <---- change to main directory
docker-compose -f ./docker-compose.prod.yml up -p 3000:3000 -d # <---- build and run on port 3000
Open http://localhost:3000 with your browser to see the result.
Requirements:
- VPS with linux
- Docker
1- Move deployment folder to your server /home/{USER}/deployment
docker compose up
2- Generate a fake certificate for your domain.com
openssl req -x509 -nodes -newkey rsa:4096 -days 1 -keyout 'privkey.pem' -out 'fullchain.pem' -subj '/CN=localhost'"
3- Move the fake certificate to /home/{USER}/deployment/certbot/conf/live/{domain.com}/
4- Update /deployment/.env
with your
DOCKER_HUB_REPOSITORY=
CERTBOT_EMAIL=
CERTBOT_DOMAIN=
5- Run the server with docker compose
docker compose up
in this section we will setup CI/CD on each commit on master to build and push our frontend image into our docker repository on DockerHub and deploy our server through ssh.
the script is available at deployment.yml
we only need to set few things
Requirements:
- Docker Hub account
1- Add the your docker hub username variables to your secrets in github secrets
DOCKERHUB_USERNAME # <---- docker hub username
DOCKERHUB_TOKEN # <---- docker hub token
HOST # <---- VPS ip address
USERNAME # <---- VPS user eg: root, prod ...etc
SSH_PRIVATE_KEY # <---- VPS private key to access through ssh
2- On each commit to the master branch github actions will build and push the frontend and redeploy on the server.
1- On server run
sudo certbot renew
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.