# NOT RUN {
# }
# NOT RUN {
# create a Dockerfile of your script
if(!require(containeRit)){
remotes::install_github("o2r-project/containerit")
library(containeRit)
}
## create your scheduled script, example below named schedule.R
## it will run the script whilst making the dockerfile
container <- dockerfile("schedule.R",
copy = "script_dir",
cmd = CMD_Rscript("schedule.R"),
soft = TRUE)
write(container, file = "Dockerfile")
## upload created Dockerfile to GitHub,
then use a Build Trigger to create Docker image "demoDockerScheduler"
## built trigger uses "demo-docker-scheduler" as must be lowercase
## After image is built:
## Create a VM to run the schedule
vm <- gce_vm_scheduler("my_scheduler")
## setup any SSH not on defaults
vm <- gce_vm_setup(vm, username = "mark")
## get the name of the just built Docker image that runs your script
docker_tag <- gce_tag_container("demo-docker-scheduler", project = "gcer-public")
## Schedule the docker_tag to run every day at 0453AM
gce_schedule_docker(docker_tag, schedule = "53 4 * * *", vm = vm)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab