Skip to content

Commit 04660ee

Browse files
authored
Move docker/build_all.sh to travis/build_images.sh (#2007)
* Move build_all.sh from docker/ to travis/ * Use $TRAVIS_BUILD_DIR * Remove +x from build_images.sh * Update document
1 parent 67c205d commit 04660ee

File tree

6 files changed

+37
-50
lines changed

6 files changed

+37
-50
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
script:
3030
- set -e
3131
# Build Docker images.
32-
- bash elasticdl/docker/build_all.sh
32+
- bash $TRAVIS_BUILD_DIR/scripts/travis/build_images.sh
3333
# Run pre-commit checks.
3434
- docker run --rm -it -v $PWD:/work -w /work
3535
elasticdl:dev /work/scripts/pre-commit.sh

docs/tutorials/elasticdl_local.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ minikube start --vm-driver=hyperkit --cpus 2 --memory 6144 --disk-size=20gb
3232
kubectl apply -f elasticdl/manifests/examples/elasticdl-rbac.yaml
3333
eval $(minikube docker-env)
3434
export DOCKER_BUILDKIT=1
35-
bash elasticdl/docker/build_all.sh
35+
export TRAVIS_BUILD_DIR=$PWD
36+
bash scripts/travis/build_images.sh
3637
```
3738

3839
### Summit a training job

docs/tutorials/elasticdl_on_prem_cluster.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ You should install ElasticDL first. Please refer to the installation part in [el
77
Then, build needed images.
88

99
```bash
10-
bash elasticdl/docker/build_all.sh
10+
export TRAVIS_BUILD_DIR=$PWD
11+
bash scripts/travis/build_images.sh
1112
```
1213

1314
## Submit job to cluster

elasticdl/docker/build_all.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.

elasticdl/python/elasticdl/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ElasticDL Client: Submit ElasticDL Job to Kubernetes
1+
# ElasticDL Client: Submit ElasticDL Job to Kubernetes
22

33
## Prepare Model Definition
44

@@ -29,13 +29,13 @@ For demonstration purposes, we use the data stored on `elasticdl:ci` Docker imag
2929
First we build all development Docker images, which include `elasticdl:ci` image:
3030

3131
```bash
32-
elasticdl/docker/build_all.sh
32+
export TRAVIS_BUILD_DIR=$PWD
33+
bash scripts/travis/build_images.sh
3334
```
3435

35-
Add `-gpu` if you want to build images with GPU support:
36-
```bash
37-
elasticdl/docker/build_all.sh -gpu
38-
```
36+
By default, the above script builds images with TensorFlow CPU image as the base
37+
image. If you want to switch to other images, for example, Python, Ubuntu, or
38+
TensorFlow GPU image, please edit `elasticdl/docker/Dockerfile`.
3939

4040
Submit training job (make sure you have packages `kubernetes` and `docker` installed in your running environment):
4141

@@ -101,7 +101,7 @@ python -m elasticdl.python.elasticdl.client train \
101101

102102
The difference is that we add a new argument `cluster_spec` which points to a cluster specification file.
103103
The cluster specification module includes a `cluster` component, and ElasticDL will invoke function
104-
`cluster.with_cluster(pod)` to add extra specifications to the
104+
`cluster.with_cluster(pod)` to add extra specifications to the
105105
[pod](https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1Pod.md) and invoke function
106106
`cluster.with_service(service)` to add extra specifications to the [service](https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1Service.md).
107107
Here is an example that assigns labels `"app": "elasticdl"` to the `pod` and `service`. Users can implement more customized configurations

scripts/travis/build_images.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# Copyright 2020 The ElasticDL Authors. All rights reserved.
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
docker build --target dev -t elasticdl:dev \
16+
-f "$TRAVIS_BUILD_DIR/elasticdl/docker/Dockerfile" \
17+
"$TRAVIS_BUILD_DIR"
18+
19+
docker build --target ci -t elasticdl:ci \
20+
-f "$TRAVIS_BUILD_DIR/elasticdl/docker/Dockerfile" \
21+
"$TRAVIS_BUILD_DIR"
22+
23+
docker build -t elasticdl:dev_allreduce \
24+
-f "$TRAVIS_BUILD_DIR/elasticdl/docker/Dockerfile.dev_allreduce" \
25+
"$TRAVIS_BUILD_DIR"

0 commit comments

Comments
 (0)