Last active
June 5, 2023 06:01
-
-
Save protortyp/5d841bb32f7d890e6b3f66112eb057fc to your computer and use it in GitHub Desktop.
Dockerfile for libtorch development on Apple Silicon
This file contains hidden or 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
FROM --platform=linux/amd64 ubuntu:22.04 | |
ENV DEBIAN_FRONTEND=noninteractive | |
RUN apt-get update && \ | |
apt-get install -y curl unzip wget zsh \ | |
libopenblas-dev \ | |
libjpeg-dev \ | |
libpng-dev \ | |
build-essential \ | |
gcc \ | |
make \ | |
git \ | |
cmake \ | |
clang \ | |
libssl-dev pkg-config nano vim tmux | |
# install rust | |
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
# install libtorch | |
RUN curl -L -o libtorch.zip https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.0%2Bcpu.zip && \ | |
unzip libtorch.zip && \ | |
rm libtorch.zip && \ | |
mv libtorch /opt/libtorch | |
ENV TORCH_DIR=/libtorch/share/cmake/Torch | |
ENV LIBTORCH /opt/libtorch | |
ENV LD_LIBRARY_PATH /opt/libtorch/lib:$LD_LIBRARY_PATH | |
# install cargo tools | |
RUN /root/.cargo/bin/cargo install cargo-watch && \ | |
/root/.cargo/bin/cargo install cargo-add && \ | |
/root/.cargo/bin/cargo install bunyan | |
WORKDIR /app | |
CMD ["/bin/bash"] | |
# build with | |
# docker build -t <name>:latest . | |
# run with | |
# docker run -it --platform=linux/amd64 --network=host -v $(pwd):/app <name>:latest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment