@@ -19,6 +19,11 @@ variable "TF_VERSION" {
19
19
default = " 2.12.0"
20
20
}
21
21
22
+ function "TF_LATEST_VERSION" {
23
+ params = []
24
+ result = " 2.12.0" # current upstream version
25
+ }
26
+
22
27
variable "REGISTRY" {
23
28
default = " quay.io/entropyorg/"
24
29
}
@@ -35,6 +40,21 @@ variable "NB_UID" {
35
40
default = 1000
36
41
}
37
42
43
+ function "device2tag" {
44
+ params = [device ]
45
+ result = equal (device," cpu" ) ? " " : equal (device," gpu" ) ? " -gpu" : " "
46
+ }
47
+
48
+ function "tag" {
49
+ params = [device , suffix ]
50
+ result = [
51
+ " ${ REGISTRY } ${ IMAGE } :${ TF_VERSION } ${ device2tag (device)} ${ suffix } " ,
52
+ equal (TF_VERSION, TF_LATEST_VERSION ())
53
+ ? " ${ REGISTRY } ${ IMAGE } :latest${ device2tag (device)} ${ suffix } "
54
+ : " " ,
55
+ ]
56
+ }
57
+
38
58
target "nb-all" {
39
59
args = {
40
60
NB_USER = NB_USER
@@ -47,66 +67,54 @@ target "nb-cpu" {
47
67
inherits = [ " nb-all" ]
48
68
args = {
49
69
TF_DEVICE_TYPE = " cpu"
50
- TF_DEVICE_TAG = " "
70
+ TF_DEVICE_TAG = " ${ device2tag ( " cpu " ) } "
51
71
}
52
72
}
53
73
54
74
target "nb-gpu" {
55
75
inherits = [ " nb-all" ]
56
76
args = {
57
77
TF_DEVICE_TYPE = " gpu"
58
- TF_DEVICE_TAG = " - gpu"
78
+ TF_DEVICE_TAG = " ${ device2tag ( " gpu" ) } "
59
79
}
60
80
}
61
81
62
82
target "base" {
63
- inherits = [ " nb-all " ]
83
+ inherits = [ " nb-cpu " ]
64
84
dockerfile = " docker/Dockerfile"
65
85
target = " base"
66
- tags = [
67
- " ${ REGISTRY } ${ IMAGE } :latest" ,
68
- " ${ REGISTRY } ${ IMAGE } :${ TF_VERSION } " ,
69
- ]
86
+ tags = tag (" cpu" , " " )
70
87
}
71
88
72
89
target "nb-image-class" {
73
- inherits = [ " nb-all " ]
90
+ inherits = [ " nb-cpu " ]
74
91
dockerfile = " docker/Dockerfile.nb-image-class"
75
92
target = " image-classification"
76
93
contexts = {
77
94
base = " target:base"
78
95
}
79
- tags = [
80
- " ${ REGISTRY } ${ IMAGE } :latest-nb-image-class" ,
81
- " ${ REGISTRY } ${ IMAGE } :${ TF_VERSION } -nb-image-class" ,
82
- ]
96
+ tags = tag (" cpu" , " -nb-image-class" )
83
97
}
84
98
85
99
target "nb-gene-expr-pred" {
86
- inherits = [ " nb-all " ]
100
+ inherits = [ " nb-cpu " ]
87
101
dockerfile = " docker/Dockerfile.nb-gene-expr-pred"
88
102
target = " gene-expression-prediction"
89
103
contexts = {
90
104
base = " target:base"
91
105
}
92
- tags = [
93
- " ${ REGISTRY } ${ IMAGE } :latest-nb-gene-expr-pred" ,
94
- " ${ REGISTRY } ${ IMAGE } :${ TF_VERSION } -nb-gene-expr-pred" ,
95
- ]
106
+ tags = tag (" cpu" , " -nb-gene-expr-pred" )
96
107
}
97
108
98
109
target "nb-omnibus" {
99
- inherits = [ " nb-all " ]
110
+ inherits = [ " nb-cpu " ]
100
111
dockerfile = " docker/Dockerfile.nb-omnibus"
101
112
contexts = {
102
113
base = " target:base"
103
114
nb-image-class = " target:nb-image-class"
104
115
nb-gene-expr-pred = " target:nb-gene-expr-pred"
105
116
}
106
- tags = [
107
- " ${ REGISTRY } ${ IMAGE } :latest-nb-omnibus" ,
108
- " ${ REGISTRY } ${ IMAGE } :${ TF_VERSION } -nb-omnibus" ,
109
- ]
117
+ tags = tag (" cpu" , " -nb-omnibus" )
110
118
}
111
119
112
120
target "gpu-nb-omnibus" {
@@ -122,8 +130,5 @@ target "gpu-nb-omnibus" {
122
130
contexts = {
123
131
nb-base = " target:nb-omnibus"
124
132
}
125
- tags = [
126
- " ${ REGISTRY } ${ IMAGE } :latest-gpu-nb-omnibus" ,
127
- " ${ REGISTRY } ${ IMAGE } :${ TF_VERSION } -gpu-nb-omnibus" ,
128
- ]
133
+ tags = tag (" gpu" , " -nb-omnibus" )
129
134
}
0 commit comments