Skip to content
Permalink
Browse files

update dockerfile (#4202)

Summary:
The current Dockerfile is out of date. This update provides an updated version, as well as instructions on building and running it.

Documentation:
There is a README included with this Dockerfile, along with comments in the Dockerfile itself.

This is an attempt at addressing #2903.
Pull Request resolved: #4202

Test Plan: I have built and tested this Dockerfile by compiling a release build of glow inside it and running the InterpreterOperatorTest. An existing build is available on DockerHub at neildhar/glow (which builds out of [this](https://github.com/neildhar/glow-docker) repository).

Reviewed By: jfix71

Differential Revision: D20551906

Pulled By: neildhar

fbshipit-source-id: 8fa88a2cd59022601747832f0694d2040257c123
  • Loading branch information
neildhar authored and facebook-github-bot committed Mar 24, 2020
1 parent c127f85 commit 647e01e67d4b8b65a69b86f9d83d355daaaba92a
Showing with 59 additions and 32 deletions.
  1. +36 −31 utils/docker/Dockerfile
  2. +22 −0 utils/docker/README.md
  3. +1 −1 utils/docker/build.sh
@@ -1,36 +1,41 @@
# for CPU env
FROM ubuntu:16.04
FROM ubuntu:18.04

LABEL version="0.1"
ARG WORKDIR=/root/dev

# Install Glow dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
wget \
clang-6.0 \
llvm-6.0 \
llvm-6.0-dev \
llvm-6.0-tools \
libpng-dev \
python-dev \
ninja-build \
# onnx dependencies
protobuf-compiler \
libprotoc-dev \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Create working folder
RUN mkdir -p $WORKDIR
WORKDIR $WORKDIR

RUN wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py && \
python get-pip.py && \
rm get-pip.py
# Update and install tools
RUN apt-get update && \
apt-get install -y clang clang-8 cmake graphviz libpng-dev \
libprotobuf-dev llvm-8 llvm-8-dev ninja-build protobuf-compiler wget \
opencl-headers libgoogle-glog-dev libboost-all-dev \
libdouble-conversion-dev libevent-dev libssl-dev libgflags-dev \
libjemalloc-dev libpthread-stubs0-dev \
# Additional dependencies
git python-numpy && \
# Delete outdated llvm to avoid conflicts
apt-get autoremove -y llvm-6.0 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Redirect clang
RUN ln -s /usr/bin/clang-6.0 /usr/bin/clang
RUN ln -s /usr/bin/clang++-6.0 /usr/bin/clang++
# Point clang to llvm-8 version
RUN update-alternatives --install /usr/bin/clang clang \
/usr/lib/llvm-8/bin/clang 50 && \
update-alternatives --install /usr/bin/clang++ clang++ \
/usr/lib/llvm-8/bin/clang++ 50

# Install ninja and (newest version of) cmake through pip
RUN pip --no-cache-dir install \
ninja \
cmake \
lit
# Point default C/C++ compiler to clang
RUN update-alternatives --set cc /usr/bin/clang && \
update-alternatives --set c++ /usr/bin/clang++

# Install fmt
RUN git clone https://github.com/fmtlib/fmt && \
mkdir fmt/build && \
cd fmt/build && \
cmake .. && make && \
make install

# Clean up
RUN rm -rf fmt
@@ -0,0 +1,22 @@
# Glow Docker image
This is a wrapper containing all of the dependencies needed to build glow.

## Building container
To build the container, `cd` into the directory containing the Dockerfile and run:
```bash
docker build -t pytorch/glow .
```

## Running container
1. Clone glow repository to some `/my/path/glow`
2. Create `/my/path/build_Debug` and `/my/path/build_Release`
3. Run container using
```bash
docker run -it -v /my/path/:/root/dev pytorch/glow
```

Use the shell to build glow in the `/root/dev` folder as you normally would. All dependencies should already be satisfied.

If you want an additional shell to access the container, run `docker ps` to find the container name and then run `docker exec -it container_name /bin/bash`.

Note that this will mount the local glow source folder into the docker container. Edits made in the container are persistent (since they are effectively made on the host). Similarly, you can edit the files on the host (in your favourite text editor) and have them immediately reflected in the container.
@@ -14,4 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

docker build -f Dockerfile -t pytorch/glow-0.1 .
docker build -t pytorch/glow .

0 comments on commit 647e01e

Please sign in to comment.
You can’t perform that action at this time.