Using Docker
Building with Docker
The samples rely on Docker for the Genvid Services as well as building and running the website. You can either install a version of Docker locally or create a Docker build server directly on Amazon EC2.
While docker-machine is deprecated upstream and the availability of the default AMI for it can change, the Genvid Toolbox includes an option to create a Docker remote-host using the default AMI. This is a safer alternative when using the Genvid Toolbox.
To create a new remote Docker instance with a Genvid AMI, use the
genvid-ami
command with the create-docker-machine
option.
genvid-ami create-docker-machine [docker-name]
[docker-name]
is a unique name to refer to the machine.
Then use docker-machine installed under bin
to control your
instance. For example, to terminate your remote instance, run:
bin\docker-machine rm [docker-name]
See Install Docker on Windows if you prefer to use a local installation.
Building Your Project
The Tutorial sample has only a small amount of content. So we can build an
archive and make it available for upload under the images
subdirectory.
This command also builds the website which requires Docker to succeed, so you
need to advertise your Docker installation or server.
# On Windows command prompt
@FOR /f "tokens=*" %i IN ('"bin\docker-machine" env [docker-name]') DO @%i
# On bash for Windows
eval $(bin/docker-machine env [docker-name])
# With Powershell
bin/docker-machine env [docker-name] | Invoke-Expression
Where [docker-name]
is the name you chose or default
if you’re running
Docker locally. When the command finishes, you can build the game and the web.
cd samples/cube/directx
py directx.py prepare
py directx.py build-cloud
cd ../web
py web.py build-cloud
This builds two archives in the respective images
subdirectory. Note that the
script puts a checksum in the image name and removes any old images. A
production version of the script should probably be more conservative and keep
the old version.