-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Remove conda from the images. Because conda contains a file named /opt/miniconda/lib/libcrypto.so.1.0.0 which can't pass our security scan. Also, it will be easier for us to manage the third party usage registrations. 2. Remove openssh from the images. Because the official openssh package provided by Ubuntu can't pass our security scan. 3. Reduce the image size to 1/3 by using stages. Also, because it contains less packages, it will be less often needed to update. 4. Put the LICENSE-IMAGE.txt file in right place. It is missed in current images. You can see it was added to a temp folder "/code" but it got deleted afterwards. 5. Update the CPU docker image's base image to Ubuntu 18.04. The GPU one is already 18.04. It's better to keep them the same. 6. Remove the build arg ONNXRUNTIME_REPO/ONNXRUNTIME_BRANCH. Instead, the new one always uses the local source. I feel it can reduce confusion.
- Loading branch information
Showing
4 changed files
with
26 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
.git | ||
.gitignore | ||
.gitattributes | ||
docs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,27 +6,19 @@ | |
|
||
# nVidia cuda 10.2 Base Image | ||
FROM nvidia/cuda:10.2-cudnn8-devel | ||
MAINTAINER Vinitra Swamy "[email protected]" | ||
MAINTAINER Changming Sun "[email protected]" | ||
ADD . /code | ||
|
||
ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime | ||
ARG ONNXRUNTIME_BRANCH=master | ||
|
||
RUN apt-get update &&\ | ||
apt-get install -y sudo git bash unattended-upgrades | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && apt-get install -y --no-install-recommends python3-dev ca-certificates g++ python3-numpy gcc make git python3-setuptools python3-wheel python3-pip unattended-upgrades | ||
RUN unattended-upgrade | ||
|
||
WORKDIR /code | ||
ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:/code/cmake-3.14.3-Linux-x86_64/bin:/opt/miniconda/bin:${PATH} | ||
ENV LD_LIBRARY_PATH /opt/miniconda/lib:$LD_LIBRARY_PATH | ||
ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH} | ||
RUN apt-get update && apt-get install -y --no-install-recommends python3-dev ca-certificates g++ python3-numpy gcc make git python3-setuptools python3-wheel python3-pip aria2 && aria2c -q -d /tmp -o cmake-3.18.2-Linux-x86_64.tar.gz https://github.com/Kitware/CMake/releases/download/v3.18.2/cmake-3.18.2-Linux-x86_64.tar.gz && tar -zxf /tmp/cmake-3.18.2-Linux-x86_64.tar.gz --strip=1 -C /usr | ||
|
||
RUN cd /code && /bin/bash ./build.sh --skip_submodule_sync --cuda_home /usr/local/cuda --cudnn_home /usr/lib/x86_64-linux-gnu/ --use_cuda --config Release --build_wheel --update --build --parallel --cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER) 'CMAKE_CUDA_ARCHITECTURES=30;37;50;52;60;70' | ||
|
||
# Prepare onnxruntime repository & build onnxruntime with CUDA | ||
RUN git clone --single-branch --branch ${ONNXRUNTIME_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime &&\ | ||
/bin/sh onnxruntime/dockerfiles/scripts/install_common_deps.sh &&\ | ||
cp onnxruntime/docs/Privacy.md /code/Privacy.md &&\ | ||
cp onnxruntime/ThirdPartyNotices.txt /code/ThirdPartyNotices.txt &&\ | ||
cp onnxruntime/dockerfiles/LICENSE-IMAGE.txt /code/LICENSE-IMAGE.txt &&\ | ||
cd onnxruntime &&\ | ||
/bin/sh ./build.sh --cuda_home /usr/local/cuda --cudnn_home /usr/lib/x86_64-linux-gnu/ --use_cuda --config Release --build_wheel --update --build --cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER) &&\ | ||
pip install /code/onnxruntime/build/Linux/Release/dist/*.whl &&\ | ||
cd .. &&\ | ||
rm -rf onnxruntime cmake-3.14.3-Linux-x86_64 | ||
FROM nvidia/cuda:10.2-cudnn8-runtime | ||
COPY --from=0 /code/build/Linux/Release/dist /root | ||
COPY --from=0 /code/dockerfiles/LICENSE-IMAGE.txt /code/LICENSE-IMAGE.txt | ||
RUN apt-get update && apt-get install -y --no-install-recommends libstdc++6 ca-certificates python3-setuptools python3-wheel python3-pip && python3 -m pip install /root/*.whl && rm -rf /root/*.whl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,24 +4,17 @@ | |
# -------------------------------------------------------------- | ||
# Dockerfile to run ONNXRuntime with source build for CPU | ||
|
||
# Ubuntu 16.04 Base Image | ||
FROM ubuntu:16.04 | ||
MAINTAINER Vinitra Swamy "[email protected]" | ||
FROM ubuntu:18.04 | ||
MAINTAINER Changming Sun "[email protected]" | ||
ADD . /code | ||
|
||
ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime | ||
ARG ONNXRUNTIME_SERVER_BRANCH=master | ||
|
||
RUN apt-get update &&\ | ||
apt-get install -y sudo git bash | ||
|
||
WORKDIR /code | ||
ENV PATH /opt/miniconda/bin:/code/cmake-3.14.3-Linux-x86_64/bin:${PATH} | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && apt-get install -y --no-install-recommends python3-dev ca-certificates g++ python3-numpy gcc make git python3-setuptools python3-wheel python3-pip aria2 && aria2c -q -d /tmp -o cmake-3.18.2-Linux-x86_64.tar.gz https://github.com/Kitware/CMake/releases/download/v3.18.2/cmake-3.18.2-Linux-x86_64.tar.gz && tar -zxf /tmp/cmake-3.18.2-Linux-x86_64.tar.gz --strip=1 -C /usr | ||
|
||
# Prepare onnxruntime repository & build onnxruntime | ||
RUN git clone --single-branch --branch ${ONNXRUNTIME_SERVER_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime &&\ | ||
/bin/sh onnxruntime/dockerfiles/scripts/install_common_deps.sh &&\ | ||
cd onnxruntime &&\ | ||
/bin/sh ./build.sh --use_openmp --config Release --build_wheel --update --build --parallel --cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER) &&\ | ||
pip install /code/onnxruntime/build/Linux/Release/dist/*.whl &&\ | ||
cd .. &&\ | ||
rm -rf onnxruntime cmake-3.14.3-Linux-x86_64 | ||
RUN cd /code && /bin/bash ./build.sh --skip_submodule_sync --use_openmp --config Release --build_wheel --update --build --parallel --cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER) | ||
|
||
FROM ubuntu:18.04 | ||
COPY --from=0 /code/build/Linux/Release/dist /root | ||
COPY --from=0 /code/dockerfiles/LICENSE-IMAGE.txt /code/LICENSE-IMAGE.txt | ||
RUN apt-get update && apt-get install -y --no-install-recommends libstdc++6 libgomp1 ca-certificates python3-setuptools python3-wheel python3-pip && python3 -m pip install /root/*.whl && rm -rf /root/*.whl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters