Skip to content

Commit

Permalink
predownload registry JSON + install system deps in early layer
Browse files Browse the repository at this point in the history
  • Loading branch information
kaczmarj committed Jun 29, 2023
1 parent 8772216 commit 83688e2
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
# FIXME: when using the torch 2.0.1 image, we get an error
# OSError: /lib/x86_64-linux-gnu/libgobject-2.0.so.0: undefined symbol: ffi_type_uint32, version LIBFFI_BASE_7.0
# The error is fixed by
# LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libffi.so.7

FROM pytorch/pytorch:2.0.0-cuda11.7-cudnn8-runtime
WORKDIR /opt/wsinfer
COPY . .
ARG DEBIAN_FRONTEND="noninteractive"
ENV TZ=Etc/UTC

# Install system dependencies.
RUN apt-get update \
&& apt-get install -y --no-install-recommends gcc g++ git libopenslide0 \
&& python -m pip install --no-cache-dir --editable . \
&& rm -rf /var/lib/apt/lists/*

# Install wsinfer.
WORKDIR /opt/wsinfer
COPY . .
RUN python -m pip install --no-cache-dir --editable .

# Use a writable directory for downloading model weights. Default is ~/.cache, which is
# not guaranteed to be writable in a Docker container.
ENV TORCH_HOME=/var/lib/wsinfer
RUN mkdir -p "$TORCH_HOME" \
&& chmod 777 "$TORCH_HOME" \
&& chmod a+s "$TORCH_HOME"

# Test that the program runs (and also download the registry JSON file).
RUN wsinfer --help

WORKDIR /work
ENTRYPOINT ["wsinfer"]
CMD ["--help"]
Expand Down

0 comments on commit 83688e2

Please sign in to comment.