Skip to content

Commit

Permalink
working build VM (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEdmondson1234 committed Feb 17, 2017
1 parent ed492a8 commit 2350119
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Let Rstudio users be added with staff rights so they can install packages etc.
- Add ability to specify disk size when creating a VM (#38) - thanks @jburos
- Add firewall functions (#34)
- Add a builder template to build docker images on a dedicated VM (#32)

# googleComputeEngineR 0.1.0

Expand Down
10 changes: 8 additions & 2 deletions R/container.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ gce_vm_template <- function(template = c("rstudio","shiny","opencpu",
dynamic_image=NULL,
dockerfile = NULL,
build_name = NULL,
image_family = "gci-stable",
image_family = "cos-stable",
name,
...){

Expand Down Expand Up @@ -134,8 +134,14 @@ gce_vm_template <- function(template = c("rstudio","shiny","opencpu",
if(is.null(dockerfile)){
stop("Need to supply Dockerfile file location to build from")
}

the_file <- paste(" ",
readLines(dockerfile, file.info(dockerfile)$size),
collapse = "\n")

cloud_init_file <- sprintf(cloud_init_file, dockerfile, build_tag, build_tag)
cloud_init_file <- sprintf(cloud_init_file,
the_file,
build_tag, build_tag)

} else {
warning("No template settings found for ", template)
Expand Down
7 changes: 3 additions & 4 deletions inst/cloudconfig/builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ users:
uid: 2000

write_files:
- path: /home/gcer/buildfolder/Dockerfile
- path: /home/gcer/build/Dockerfile
permissions: 0644
owner: root
content: |
%s
%s

runcmd:
- docker build -t build_me /home/gcer/buildfolder/Dockerfile
- docker tag build_me %s
- cd /home/gcer/build && docker build -t %s .
- /usr/share/google/dockercfg_update.sh
- docker push %s
2 changes: 1 addition & 1 deletion man/gce_vm_template.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions tests/testthat/test_images.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ test_that("We can list images", {
test_that("We can get an image from a family", {
skip_on_cran()

image <- gce_get_image_family(image_project = "google-containers", family = "gci-stable")
image <- gce_get_image_family(image_project = "google-containers", family = "cos-stable")

expect_equal(image$kind, "compute#image")
expect_equal(image$family, "gci-stable")
expect_equal(image$family, "cos-stable")

})

test_that("We can get a specific image", {
skip_on_cran()

image <- gce_get_image(image_project = "google-containers", image = "gci-stable-53-8530-85-0")
image <- gce_get_image(image_project = "google-containers", image = "cos-stable-53-8530-85-0")

expect_equal(image$kind, "compute#image")
})

0 comments on commit 2350119

Please sign in to comment.