Step by Step guide for creating and running a Docker image of VRSpace
Added by Nick Naglich almost 3 years ago
Guide to pull/build/run a Debian based image of VRSpace from github¶
Requirements:- Docker Desktop for Windows - https://www.docker.com/products/docker-desktop
- Basic knowledge of Powershell
- Basic knowledge of Docker
This guide assumes you already have Docker Desktop setup and running.
If not please refer to this guide: https://docs.docker.com/desktop/windows/install/
Lets get started¶
Download the dockerfile attached to this post or create one with the following code:
# syntax=docker/dockerfile:1 FROM debian:latest #Install git, bash, java, maven RUN apt update && apt install -y \ git \ bash-completion \ default-jdk\ maven #Set working directory WORKDIR /home/ #Clone VRSpace from github RUN git clone https://github.com/jalmasi/vrspace.git #Expose ports 8080 and 8443 EXPOSE 8080 EXPOSE 8443
This will tell Docker to pull the latest Debian image, install "git, bash, java, and maven"
then clone the VRSpace github repo into the /home/vrspace/ directory, and expose ports 8080 and 8443.
Next open Powershell and navigate to the directory with the dockerfile
run the command
docker build -t vrspace .
This will create an image called vrspace from the dockerfile
It may take a while to download everything and you should end up with an image that's about 3GB
Run the image as a container¶
Open the Docker Desktop GUI and navigate to Images on the lefthand menu.
Hover over the vrspace image we created and click the blue run button that appears on the right.
Click the optional settings and then plus button on the righthand side of Container Port.
Fill in the Local Host ports to match the container port (unless you need it to be something else)
Add a name then click Run
Compile VRSpace inside the container¶
Inside the Docker Desktop GUI navigate to Container/Apps on the lefthand side
You should see your started container
Hover over the container and click the CLI button on the righthand side that appears
In the command prompt that pops up type:
cd vrspace
then
mvn clean install -DskipTests
This will download the requirements for maven then compile VRSpace
Run the webserver and log into VRSpace on the local machine¶
Navigate to the server directory with
cd server
then run the server with:
java -jar target/server-0.4.5-SNAPSHOT.jar
Congrats you now have a local instance of VRSpace running inside a Docker Container!
Navigate to the server¶
Open a web browser and go to:
http://localhost:8080/babylon/
This will take you to a directory view of test pages you can run
If you want to jump into the portal page go to:
http://localhost:8080/babylon/avatar-selection.html
Dockerfile (369 Bytes) Dockerfile | Dockerfile for image creation |
Replies (7)
RE: Step by Step guide for creating and running a Docker image of VRSpace - Added by Nate Lager almost 3 years ago
Nice work, why not add the build to the container file though? I did a little experimentation in building as a container a few weeks ago (except I was using RHEL UBI instead of debian, yes it's free). Here's my containerfile.
FROM registry.access.redhat.com/ubi8/ubi RUN dnf -y install maven git java-11-openjdk WORKDIR /app RUN git clone https://github.com/jalmasi/vrspace.git WORKDIR /app/vrspace RUN JAVA_HOME=/usr/lib/jvm/jre-11/ mvn clean install -DskipTests EXPOSE 8080 CMD ["/usr/lib/jvm/jre-11/bin/java", "-jar", "/app/vrspace/server/target/server-0.4.5-SNAPSHOT.jar"]
This can be improved if course, but its a start. Once we have a build thats accepted as "correct", we should get it published somewhere, dockerhub or wherever.
RE: Step by Step guide for creating and running a Docker image of VRSpace - Added by Nate Lager almost 3 years ago
Definitely not trying to step on any toes, but.
https://github.com/gangrif/vrspace-container
https://hub.docker.com/repository/docker/gangrif/vrspace/general
And I am certainly open to collaboration here.
RE: Step by Step guide for creating and running a Docker image of VRSpace - Added by Nick Naglich almost 3 years ago
No toes stepped on here. You're image looks good.
I broke it up so other developers can get a feel for docker and how to quickly build to fix bugs or change VRSpace.
Also Josip wanted an image based on Debian so I went with that distro.
Once there's a v1.0 build or something that works ~100% out of the box; the image should have it all built in and a tutorial will be made to work with NGINX and OpenVidu containers.
RE: Step by Step guide for creating and running a Docker image of VRSpace - Added by Nate Lager almost 3 years ago
Yea, having some sort of suggested docker compose or kube pod definition that just stands up everything you need would be a great setup.
The next thing I want to do is set up the container to take env variables and whatnot so you can define some of the commonly configured things.
Also, a mapped volume for your own custom world.
But before I can do any of that, i need to learn more about vrspace, and how to actually do those things.
RE: Step by Step guide for creating and running a Docker image of VRSpace - Added by Nate Lager almost 3 years ago
And now https://hub.docker.com/r/gangrif/vrspace lets you map in a /config/application.properties so you can add configuration overrides.
RE: Step by Step guide for creating and running a Docker image of VRSpace - Added by Josip Almasi over 2 years ago
Great stuff!
I have them both running! :)
(silly me I did not set host port)
RE: Step by Step guide for creating and running a Docker image of VRSpace - Added by Riley Williams almost 2 years ago
The command "java -jar target/server-0.4.5-SNAPSHOT.jar" to start the server should be updated to "java -jar target/server-0.5.0-SNAPSHOT.jar". Thanks for all the hard work!