From 2ed92c97e1bff3cf752eca495ee4d668cef6b70f Mon Sep 17 00:00:00 2001 From: butomo1989 Date: Thu, 27 Sep 2018 15:12:03 +0200 Subject: [PATCH] Added sample of docker terraform --- docker.tf | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 docker.tf diff --git a/docker.tf b/docker.tf new file mode 100644 index 0000000..c6e3ab2 --- /dev/null +++ b/docker.tf @@ -0,0 +1,44 @@ +provider "docker" { + host = "unix:///var/run/docker.sock" +} + +resource "docker_image" "selenium_hub_img" { + name = "selenium/hub:3.14.0-curium" +} + +resource "docker_image" "docker_android_img" { + name = "butomo1989/docker-android-x86-8.1:latest" +} + +resource "docker_network" "private_network" { + name = "private_network" +} + +resource "docker_container" "selenium_hub_con" { + image = "${docker_image.selenium_hub_img.latest}" + name = "selenium_hub_con" + networks = ["${docker_network.private_network.id}"] + ports { + internal = 4444 + external = 4444 + } +} + +resource "docker_container" "samsung_s6_con" { + image = "${docker_image.docker_android_img.latest}" + name = "samsung_s6_con" + privileged = true + depends_on = ["docker_container.selenium_hub_con"] + networks = ["${docker_network.private_network.id}"] + ports { + internal = 6080 + external = 6080 + } + env = [ + "DEVICE=Samsung Galaxy S6", + "CONNECT_TO_GRID=true", + "APPIUM=true", + "MOBILE_WEB_TEST=true", + "AUTO_RECORD=true" + ] +}