The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
The below installs your Github repo into the Docker container using a small Dockerfile
.
In summary:
library(googleComputeEngineR)
## start an opencpu template
vm <- gce_vm(name = "opencpu", template = "opencpu", predefined_type = "n1-standard-2")
## wait for opencpu image to load
gce_check_container(vm, "opencpu")
This Dockerfile is available via get_dockerfolder("opencpu-installgithub")
and below. It installs an OpenCPU package from my prediction of user URLs for prefetching application.
FROM opencpu/base
MAINTAINER Mark Edmondson (r@sunholo.com)
# install any package dependencies
RUN apt-get update && apt-get install -y \
nano \
## clean up
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/ \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds
## Install your custom package from Github
RUN Rscript -e "devtools::install_github(c('MarkEdmondson1234/predictClickOpenCPU'))"
The Dockerfile is used to build the custom image below:
## build a docker image with your package installed
docker_build(vm,
dockerfolder = get_dockerfolder("opencpu-installgithub"),
new_image = "opencpu-predictclick")
## push up to your private Google Container registry
gce_push_registry(vm,
save_name = "opencpu-predictclick",
image_name = "opencpu-predictclick")
In this case we don’t start a new instance, just stop the running OpenCPU container and start our own. We need to stop the default container to free up the ports 80
and 8004
that are needed for OpenCPU to work.
## stop default opencpu container
docker_cmd(vm, "stop opencpu-server")
## run custom opencpu server
docker_run(vm,
image = "opencpu-predictclick",
name = "predictclick",
detach = TRUE,
docker_opts = "-p 80:80 -p 8004:8004")
Clean up when you are done to avoid charges.
gce_vm_stop(vm)
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.