1
0
Fork 0
onnx-web/api/Containerfile.rocm.ubuntu

49 lines
1.5 KiB
Plaintext

FROM docker.io/rocm/pytorch:rocm5.4_ubuntu20.04_py3.8_pytorch_1.12.1
WORKDIR /onnx-web/api
RUN apt-get -y update \
&& apt-get install -y ffmpeg libsm6 libxext6 \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install virtualenv --upgrade
RUN python3 -m venv onnx_env
ENV PATH="/onnx-web/api/onnx_env/bin:$PATH"
RUN pip3 install pip --upgrade
# build custom ORT, from https://github.com/microsoft/onnxruntime/blob/v1.13.1/dockerfiles/Dockerfile.rocm
ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
ARG ONNXRUNTIME_BRANCH=main
WORKDIR /code
ENV PATH /opt/miniconda/bin:/code/cmake-3.24.3-linux-x86_64/bin:${PATH}
# Prepare onnxruntime repository & build onnxruntime
RUN git clone --single-branch --branch ${ONNXRUNTIME_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime &&\
/bin/sh onnxruntime/dockerfiles/scripts/install_common_deps.sh &&\
cd onnxruntime &&\
/bin/sh ./build.sh --config Release --build_wheel --update --build --parallel --cmake_extra_defines\
ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER) --use_rocm --rocm_home=/opt/rocm &&\
pip install /code/onnxruntime/build/Linux/Release/dist/*.whl &&\
cd ..
COPY requirements.txt /onnx-web/api/requirements.txt
RUN pip3 install -r requirements.txt --no-cache-dir
COPY onnx_web/ /onnx-web/api/onnx_web/
COPY launch.sh /onnx-web/launch.sh
COPY params.json /onnx-web/api/params.json
ENV ONNX_WEB_BUNDLE_PATH="/onnx-web/gui"
COPY gui/ /onnx-web/gui/
CMD [ "sh", "-c", "/onnx-web/launch.sh" ]