@@ -21,16 +21,29 @@ set -e
21
21
22
22
REGISTRY=$1
23
23
TAG=$2
24
+ ARCH=$3
24
25
25
- if [[ -z " $REGISTRY " || -z " $TAG " ]]; then
26
- echo " Image registry and tag must be set"
27
- echo " Usage: $0 <image-registry> <image-tag>" 1>&2
26
+ if [[ -z " $REGISTRY " || -z " $TAG " || -z " $ARCH " ]]; then
27
+ echo " Image registry, tag and architecture must be set"
28
+ echo " Usage: $0 <image-registry> <image-tag> <cpu-architecture> " 1>&2
28
29
exit 1
29
30
fi
30
31
32
+ SUPPORTED_CPU_ARCHS=$( docker buildx inspect | grep ' Platforms' | sed -e ' s|Platforms: ||' -e ' s|,||g' -e ' s|linux/||g' )
33
+ function check_specified_cpu_arch() {
34
+ for SUPPORTED_ARCH in $SUPPORTED_CPU_ARCHS ; do \
35
+ if [ $ARCH = $SUPPORTED_ARCH ]; then \
36
+ return 0
37
+ fi ;
38
+ done
39
+ echo " CPU architecture '$ARCH ' is not supported"
40
+ echo " You can use '$SUPPORTED_CPU_ARCHS '"
41
+ return 1
42
+ }
43
+ check_specified_cpu_arch
44
+
31
45
VERSION=" v1beta1"
32
46
CMD_PREFIX=" cmd"
33
- MACHINE_ARCH=$( uname -m)
34
47
35
48
echo " Building images for Katib ${VERSION} ..."
36
49
echo " Image registry: ${REGISTRY} "
@@ -41,77 +54,77 @@ cd ${SCRIPT_ROOT}
41
54
42
55
# Katib core images
43
56
echo -e " \nBuilding Katib controller image...\n"
44
- docker build -t ${REGISTRY} /katib-controller:${TAG} -f ${CMD_PREFIX} /katib-controller/${VERSION} /Dockerfile .
57
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /katib-controller:${TAG} -f ${CMD_PREFIX} /katib-controller/${VERSION} /Dockerfile .
45
58
46
59
echo -e " \nBuilding Katib DB manager image...\n"
47
- docker build -t ${REGISTRY} /katib-db-manager:${TAG} -f ${CMD_PREFIX} /db-manager/${VERSION} /Dockerfile .
60
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /katib-db-manager:${TAG} -f ${CMD_PREFIX} /db-manager/${VERSION} /Dockerfile .
48
61
49
62
# TODO (andreyvelich): Switch to ${CMD_PREFIX}/ui/${VERSION}/Dockerfile once old UI is deprecated.
50
63
echo -e " \nBuilding Katib UI image...\n"
51
- docker build -t ${REGISTRY} /katib-ui:${TAG} -f ${CMD_PREFIX} /new-ui/${VERSION} /Dockerfile .
64
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /katib-ui:${TAG} -f ${CMD_PREFIX} /new-ui/${VERSION} /Dockerfile .
52
65
53
66
echo -e " \nBuilding Katib cert generator image...\n"
54
- docker build -t ${REGISTRY} /cert-generator:${TAG} -f ${CMD_PREFIX} /cert-generator/${VERSION} /Dockerfile .
67
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /cert-generator:${TAG} -f ${CMD_PREFIX} /cert-generator/${VERSION} /Dockerfile .
55
68
56
69
echo -e " \nBuilding file metrics collector image...\n"
57
- docker build -t ${REGISTRY} /file-metrics-collector:${TAG} -f ${CMD_PREFIX} /metricscollector/${VERSION} /file-metricscollector/Dockerfile .
70
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /file-metrics-collector:${TAG} -f ${CMD_PREFIX} /metricscollector/${VERSION} /file-metricscollector/Dockerfile .
58
71
59
72
echo -e " \nBuilding TF Event metrics collector image...\n"
60
- if [ $MACHINE_ARCH == " ppc64le" ]; then
61
- docker build -t ${REGISTRY} /tfevent-metrics-collector:${TAG} -f ${CMD_PREFIX} /metricscollector/${VERSION} /tfevent-metricscollector/Dockerfile.ppc64le .
73
+ if [ $ARCH == " ppc64le" ]; then
74
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /tfevent-metrics-collector:${TAG} -f ${CMD_PREFIX} /metricscollector/${VERSION} /tfevent-metricscollector/Dockerfile.ppc64le .
62
75
else
63
- docker build -t ${REGISTRY} /tfevent-metrics-collector:${TAG} -f ${CMD_PREFIX} /metricscollector/${VERSION} /tfevent-metricscollector/Dockerfile .
76
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /tfevent-metrics-collector:${TAG} -f ${CMD_PREFIX} /metricscollector/${VERSION} /tfevent-metricscollector/Dockerfile .
64
77
fi
65
78
66
79
# Suggestion images
67
80
echo -e " \nBuilding suggestion images..."
68
81
69
82
echo -e " \nBuilding hyperopt suggestion...\n"
70
- docker build -t ${REGISTRY} /suggestion-hyperopt:${TAG} -f ${CMD_PREFIX} /suggestion/hyperopt/${VERSION} /Dockerfile .
83
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /suggestion-hyperopt:${TAG} -f ${CMD_PREFIX} /suggestion/hyperopt/${VERSION} /Dockerfile .
71
84
72
85
echo -e " \nBuilding chocolate suggestion...\n"
73
- docker build -t ${REGISTRY} /suggestion-chocolate:${TAG} -f ${CMD_PREFIX} /suggestion/chocolate/${VERSION} /Dockerfile .
86
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /suggestion-chocolate:${TAG} -f ${CMD_PREFIX} /suggestion/chocolate/${VERSION} /Dockerfile .
74
87
75
88
echo -e " \nBuilding hyperband suggestion...\n"
76
- docker build -t ${REGISTRY} /suggestion-hyperband:${TAG} -f ${CMD_PREFIX} /suggestion/hyperband/${VERSION} /Dockerfile .
89
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /suggestion-hyperband:${TAG} -f ${CMD_PREFIX} /suggestion/hyperband/${VERSION} /Dockerfile .
77
90
78
91
echo -e " \nBuilding skopt suggestion...\n"
79
- docker build -t ${REGISTRY} /suggestion-skopt:${TAG} -f ${CMD_PREFIX} /suggestion/skopt/${VERSION} /Dockerfile .
92
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /suggestion-skopt:${TAG} -f ${CMD_PREFIX} /suggestion/skopt/${VERSION} /Dockerfile .
80
93
81
94
echo -e " \nBuilding goptuna suggestion...\n"
82
- docker build -t ${REGISTRY} /suggestion-goptuna:${TAG} -f ${CMD_PREFIX} /suggestion/goptuna/${VERSION} /Dockerfile .
95
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /suggestion-goptuna:${TAG} -f ${CMD_PREFIX} /suggestion/goptuna/${VERSION} /Dockerfile .
83
96
84
97
echo -e " \nBuilding optuna suggestion...\n"
85
- docker build -t ${REGISTRY} /suggestion-optuna:${TAG} -f ${CMD_PREFIX} /suggestion/optuna/${VERSION} /Dockerfile .
98
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /suggestion-optuna:${TAG} -f ${CMD_PREFIX} /suggestion/optuna/${VERSION} /Dockerfile .
86
99
87
100
echo -e " \nBuilding ENAS suggestion...\n"
88
- docker build -t ${REGISTRY} /suggestion-enas:${TAG} -f ${CMD_PREFIX} /suggestion/nas/enas/${VERSION} /Dockerfile .
101
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /suggestion-enas:${TAG} -f ${CMD_PREFIX} /suggestion/nas/enas/${VERSION} /Dockerfile .
89
102
90
103
echo -e " \nBuilding DARTS suggestion...\n"
91
- docker build -t ${REGISTRY} /suggestion-darts:${TAG} -f ${CMD_PREFIX} /suggestion/nas/darts/${VERSION} /Dockerfile .
104
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /suggestion-darts:${TAG} -f ${CMD_PREFIX} /suggestion/nas/darts/${VERSION} /Dockerfile .
92
105
93
106
# Early stopping images
94
107
echo -e " \nBuilding early stopping images...\n"
95
108
96
109
echo -e " \nBuilding median stopping rule...\n"
97
- docker build -t ${REGISTRY} /earlystopping-medianstop:${TAG} -f ${CMD_PREFIX} /earlystopping/medianstop/${VERSION} /Dockerfile .
110
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /earlystopping-medianstop:${TAG} -f ${CMD_PREFIX} /earlystopping/medianstop/${VERSION} /Dockerfile .
98
111
99
112
# Training container images
100
113
echo -e " \nBuilding training container images..."
101
114
102
115
echo -e " \nBuilding mxnet mnist training container example...\n"
103
- docker build -t ${REGISTRY} /mxnet-mnist:${TAG} -f examples/${VERSION} /trial-images/mxnet-mnist/Dockerfile .
116
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /mxnet-mnist:${TAG} -f examples/${VERSION} /trial-images/mxnet-mnist/Dockerfile .
104
117
105
118
echo -e " \nBuilding PyTorch mnist training container example...\n"
106
- docker build -t ${REGISTRY} /pytorch-mnist:${TAG} -f examples/${VERSION} /trial-images/pytorch-mnist/Dockerfile .
119
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /pytorch-mnist:${TAG} -f examples/${VERSION} /trial-images/pytorch-mnist/Dockerfile .
107
120
108
121
echo -e " \nBuilding Keras CIFAR-10 CNN training container example for ENAS with GPU support...\n"
109
- docker build -t ${REGISTRY} /enas-cnn-cifar10-gpu:${TAG} -f examples/${VERSION} /trial-images/enas-cnn-cifar10/Dockerfile.gpu .
122
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /enas-cnn-cifar10-gpu:${TAG} -f examples/${VERSION} /trial-images/enas-cnn-cifar10/Dockerfile.gpu .
110
123
111
124
echo -e " \nBuilding Keras CIFAR-10 CNN training container example for ENAS with CPU support...\n"
112
- docker build -t ${REGISTRY} /enas-cnn-cifar10-cpu:${TAG} -f examples/${VERSION} /trial-images/enas-cnn-cifar10/Dockerfile.cpu .
125
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /enas-cnn-cifar10-cpu:${TAG} -f examples/${VERSION} /trial-images/enas-cnn-cifar10/Dockerfile.cpu .
113
126
114
127
echo -e " \nBuilding PyTorch CIFAR-10 CNN training container example for DARTS...\n"
115
- docker build -t ${REGISTRY} /darts-cnn-cifar10:${TAG} -f examples/${VERSION} /trial-images/darts-cnn-cifar10/Dockerfile .
128
+ docker buildx build --platform linux/ $ARCH -t ${REGISTRY} /darts-cnn-cifar10:${TAG} -f examples/${VERSION} /trial-images/darts-cnn-cifar10/Dockerfile .
116
129
117
130
echo -e " \nAll Katib images with ${TAG} tag have been built successfully!\n"
0 commit comments