Skip to content

Commit 974b25c

Browse files
authored
Follow Dockerfile guideline (#2003)
* Follow Dockerfile guideline * Fix a bug * Silence go get
1 parent a72fe35 commit 974b25c

3 files changed

Lines changed: 21 additions & 19 deletions

File tree

elasticdl/docker/Dockerfile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ ARG EXTRA_PYPI_INDEX=https://pypi.org/simple
1515
RUN apt-get -qq update && \
1616
apt-get -qq install -y unzip curl git software-properties-common g++ wget \
1717
libeigen3-dev > /dev/null && \
18-
python -m pip install --upgrade pip
18+
python -m pip install --quiet --upgrade pip
1919

2020
COPY elasticdl/requirements.txt /requirements.txt
21-
RUN python -m pip -q install -r /requirements.txt \
21+
RUN python -m pip install --quiet -r /requirements.txt \
2222
--extra-index-url=$EXTRA_PYPI_INDEX \
23-
&& rm /requirements.txt
23+
&& rm /requirements.txt
24+
2425
COPY elasticdl/requirements-dev.txt /requirements-dev.txt
25-
RUN python -m pip -q install -r /requirements-dev.txt \
26+
RUN python -m pip install --quiet -r /requirements-dev.txt \
2627
--extra-index-url=$EXTRA_PYPI_INDEX \
2728
&& rm /requirements-dev.txt
2829

@@ -78,7 +79,7 @@ RUN cd /elasticdl && \
7879

7980
# Create elasticdl package
8081
RUN cd /elasticdl && \
81-
python setup.py -q bdist_wheel && \
82+
python setup.py --quiet bdist_wheel && \
8283
cp dist/elasticdl-develop-py3-none-any.whl /
8384

8485

@@ -88,14 +89,14 @@ FROM ${BASE_IMAGE} as ci
8889
ARG EXTRA_PYPI_INDEX=https://pypi.org/simple
8990

9091
COPY elasticdl/docker/bashrc /etc/bash.bashrc
91-
RUN chmod a+rwx /etc/bash.bashrc
92+
RUN chmod a+rx /etc/bash.bashrc
9293

9394
# Copy data
9495
COPY --from=dev /data /data
9596

9697
# Copy model zoo
9798
COPY model_zoo /model_zoo
98-
RUN python -m pip -q install -r /model_zoo/requirements.txt \
99+
RUN python -m pip install --quiet -r /model_zoo/requirements.txt \
99100
--extra-index-url=${EXTRA_PYPI_INDEX}
100101

101102
# Copy GO PS
@@ -108,7 +109,7 @@ WORKDIR /
108109

109110
# Install elasticdl package
110111
COPY --from=dev /elasticdl-develop-py3-none-any.whl /
111-
RUN python -m pip -q install /elasticdl-develop-py3-none-any.whl \
112+
RUN python -m pip install --quiet /elasticdl-develop-py3-none-any.whl \
112113
--extra-index-url=${EXTRA_PYPI_INDEX} \
113114
&& rm /elasticdl-develop-py3-none-any.whl
114115

elasticdl/docker/Dockerfile.dev_allreduce

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ FROM elasticdl:dev
33
WORKDIR /root/
44

55
# Note that pip is having issue downloading PyTorch on manylinux so we use curl to download it instead
6-
RUN curl -o torch-1.4.0-cp36-cp36m-manylinux1_x86_64.whl \
6+
RUN curl -sLo torch-1.4.0-cp36-cp36m-manylinux1_x86_64.whl \
77
https://files.pythonhosted.org/packages/24/19/4804aea17cd136f1705a5e98a00618cb8f6ccc375ad8bfa437408e09d058/torch-1.4.0-cp36-cp36m-manylinux1_x86_64.whl
8-
RUN pip install torch-1.4.0-cp36-cp36m-manylinux1_x86_64.whl && \
8+
RUN python -m pip install --quiet torch-1.4.0-cp36-cp36m-manylinux1_x86_64.whl && \
99
rm torch-1.4.0-cp36-cp36m-manylinux1_x86_64.whl
1010

1111
RUN git clone --depth=1 https://github.com/caicloud/ftlib.git
12-
RUN cd /root/ftlib && pip install -r requirements.txt
12+
RUN cd /root/ftlib && python -m pip install --quiet -r requirements.txt
1313
RUN cd /root/ftlib/ftlib/consensus/gossip && bash ./gen_shared_lib.sh
1414
RUN cp -r /root/ftlib/ftlib /usr/local/lib/python3.6/dist-packages/ftlib

elasticdl/docker/scripts/install-go.bash

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ set -e
44

55
GO_MIRROR_URL=$1
66

7-
curl --silent ${GO_MIRROR_URL}/go1.13.4.linux-amd64.tar.gz | tar -C /usr/local -xzf -
7+
curl --silent "$GO_MIRROR_URL"/go1.13.4.linux-amd64.tar.gz | \
8+
tar -C /usr/local -xzf -
89

910
go env -w GO111MODULE=on
1011
go env -w GOPROXY=https://goproxy.io,direct
1112

12-
go get github.com/golang/protobuf/[email protected]
13-
go get golang.org/x/lint/golint
14-
go get golang.org/x/tools/cmd/goyacc
15-
go get golang.org/x/tools/cmd/cover
16-
go get github.com/mattn/goveralls
17-
go get github.com/rakyll/gotest
13+
go get github.com/golang/protobuf/[email protected] > /dev/null
14+
go get golang.org/x/lint/golint > /dev/null
15+
go get golang.org/x/tools/cmd/goyacc > /dev/null
16+
go get golang.org/x/tools/cmd/cover > /dev/null
17+
go get github.com/mattn/goveralls > /dev/null
18+
go get github.com/rakyll/gotest > /dev/null
1819

19-
cp $GOPATH/bin/* /usr/local/bin/
20+
cp "$GOPATH"/bin/* /usr/local/bin/

0 commit comments

Comments
 (0)