Building Docusaurus website using docusaurus container.
The guide will help you develop websites and host it on to github using Docusaurus.
-
Installing docker. Open up a new Terminal by pressing
Ctrl
+Alt
+t
sudo apt update sudo apt install git git clone https://gitlab.iotiot.in/newbies/pre-office-office/docker-containers.git cd docker-containers sudo install-docker-ubuntu-16.04.sh
-
Note: The script will automatically install and reboot your system.
-
Note: These steps only work on Ubuntu 16.04 OS. Any other OS will cause an error.
-
After the system reboots, Open up a new Terminal by pressing
Ctrl
+Alt
+t
. -
Run command
sudo docker --version
to verify that docker is successfully installed.# The output should be a docker version $ sudo docker --version Docker version 19.03.13, build 4484c46d9d
-
-
Start docker container by running command, in the same terminal
cd docker-containers/docusaurus-container sudo ./start
-
Initialize the docusaurus by running the command
npx @docusaurus/init@next init {name-of-the-website} classic
-
To preview the website run command
cd {name-of-the-website} yarn start --host 0.0.0.0 --port 3000
See your website by typing http://localhost:3000 in the address bar of your browser.
-
Making changes to the website
-
Uploading website to Github.
-
Configure your website for Github, You need to these changes to your
docusaurus.config.js
... url: 'https://__userName__.github.io', // Your website URL baseUrl: '/testProject/', projectName: 'testProject', organizationName: 'userName' ...
For example : Lets say my github project name is -
Shuny-Interfaces
and my user name isshunyaos
Then the
docusaurus.config.js
will be... url: 'https://shunyaos.github.io', // Your website URL baseUrl: '/Shunya-Interfaces/', projectName: 'Shunya-Interfaces', organizationName: 'shunyaos' ...
-
To upload the website to github run command.
git config --global user.email "{your-email-id}" git config --global user.name "{Your-name}" GIT_USER={your-git-username} yarn deploy
-