Dockerizing a threejs app or website is alot easier than may seem. First, ensure you have met the pre-requisites:
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt-get update
sudo apt install docker-ce -y
sudo usermod -aG docker $USER
newgrp docker
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo apt-get update
Now that you have docker & docker-compose installed,
and a three.js project, you can serve your project a couple different ways with docker.
npm run dev
docker run -p 8822:80 -v ~/my-project/src/index:/usr/share/nginx/html -d nginx
npm run start
docker run -p 8822:80 -v ~/my-project/build:/usr/share/nginx/html -d nginx
docker login registry.gitlab.com/your-username/your-repo-name
docker -t registry.gitlab.com/your-username/your-repo-name:yourtagname
docker push registry.gitlab.com/your-username/your-repo-name:yourtagname
More coming soon