Skip to content

Commit

Permalink
Merge pull request #281 from nanli-emory/ray_cluster_functionality
Browse files Browse the repository at this point in the history
Update Dockerfile for ray-ml
  • Loading branch information
jacksonjacobs1 authored Mar 21, 2024
2 parents c9f2b40 + fc5edc6 commit 6a1618e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 25 deletions.
35 changes: 12 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
# Dockerfile for HistoQC.
#
# This Dockerfile uses two stages. In the first, the project's python dependencies are
# installed. This requires a C compiler. In the second stage, the HistoQC directory and
# the python environment are copied over. We do not require a C compiler in the second
# stage, and so we can use a slimmer base image.

FROM python:3.8 AS builder
ARG DEBIAN_FRONTEND=noninteractive
WORKDIR /opt/HistoQC
COPY . .
# Create virtual environment for this project. This makes it easier to copy the Python
# installation into the second stage of the build.
ENV PATH="/opt/HistoQC/venv/bin:$PATH"
RUN python -m venv venv \
&& python -m pip install --no-cache-dir setuptools wheel \
&& python -m pip install --no-cache-dir -r requirements.txt \
&& python -m pip install --no-cache-dir . \
# We force this so there is no error even if the dll does not exist.
&& rm -f libopenslide-0.dll

FROM python:3.8-slim
FROM rayproject/ray-ml:latest-gpu
ARG DEBIAN_FRONTEND=noninteractive
USER root
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libopenslide0 \
libtk8.6 \
procps \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /opt/HistoQC
COPY --from=builder /opt/HistoQC/ .
ENV PATH="/opt/HistoQC/venv/bin:$PATH"
COPY . .
# install
RUN pip install --no-cache-dir setuptools wheel \
&& pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir . \
&& rm -f libopenslide-0.dll

WORKDIR /data

CMD ["bash"]

2 changes: 1 addition & 1 deletion histoqc/BaseImage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
import os
import os, re
import numpy as np
import zlib, dill
from distutils.util import strtobool
Expand Down
1 change: 1 addition & 0 deletions histoqc/import_wrapper/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .openslide import openslide
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ packages =
histoqc.config
histoqc.data
histoqc.ui
histoqc.import_wrapper
python_requires = >=3.7
install_requires =
importlib_resources; python_version < '3.9'
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
for f in glob.iglob(f"histoqc/data/{folder}/**/*", recursive=True)
if os.path.isfile(f)
]

import_wrapper_files = [
os.path.relpath(f, "histoqc/import_wrapper_files/")
for f in glob.iglob(f"histoqc/import_wrapper_files/**/*", recursive=True)
if os.path.isfile(f)
]
setup(
use_scm_version={
# duplicated config from pyproject.toml; keep in sync
Expand All @@ -28,5 +32,6 @@
'histoqc.config': ['*.ini'],
'histoqc.data': data_files,
'histoqc.ui': ui_files,
'histoqc.import_wrapper': import_wrapper_files
}
)

0 comments on commit 6a1618e

Please sign in to comment.