-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
43 lines (38 loc) · 680 Bytes
/
Copy pathmain.tf
File metadata and controls
43 lines (38 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
}
}
}
provider "docker" {}
resource "docker_image" "api" {
name = "api"
build {
path = "."
}
}
resource "docker_container" "api" {
name = "api"
image = docker_image.api.latest
ports {
internal = 5000
external = 5000
}
}
resource "docker_image" "nginx" {
name = "nginx"
}
resource "docker_container" "nginx" {
name = "nginx"
image = docker_image.nginx.latest
ports {
internal = 80
external = 8000
}
volumes {
host_path = "${abspath(path.root)}/html"
container_path = "/usr/share/nginx/html"
read_only = true
}
}