Skip to content

Commit 1d4d58a

Browse files
Release v0.16.4: CI: updated readimc, new cellpose container with cellposeSAM, updated docker build with ubuntu-latest and xpra containers
1 parent b723798 commit 1d4d58a

File tree

3 files changed

+128
-15
lines changed

3 files changed

+128
-15
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ jobs:
181181
target: steinbock-cellpose
182182
platforms: linux/amd64,linux/arm64
183183
build-args: |
184-
STEINBOCK_TARGET=steinbock-cellpose
185184
STEINBOCK_VERSION=${{ steps.steinbock_meta.outputs.version }}
185+
CELLPOSE_VERSION=4.0.8
186186
tags: ${{ steps.steinbock_cellpose_container_meta.outputs.tags }}
187187
labels: ${{ steps.steinbock_cellpose_container_meta.outputs.labels }}

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
### Changed
1212

1313
- Updated readimc to 0.9.2
14-
- Changed Cellpose container and description to v4.0.8, using CellposeSAM
14+
- Changed Cellpose container and description to v4.0.8, using CellposeSAM, included arm64 build
1515
- Updated build.yml to run ghcr docker build on ubuntu-latest
16-
- removed gpu-, xpra docker build
16+
- removed xpra docker build
1717

1818
## [0.16.3] - 2024-05-29
1919

Dockerfile

Lines changed: 125 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# syntax=docker/dockerfile:1.7
2+
13
# "tensorflow" or "tensorflow-gpu"
24
ARG TENSORFLOW_TARGET="tensorflow"
35

@@ -23,7 +25,9 @@ FROM --platform=linux/amd64 tensorflow/tensorflow:${TENSORFLOW_VERSION} AS tenso
2325

2426
ARG TENSORFLOW_VERSION
2527

26-
ENV DEBIAN_FRONTEND="noninteractive" PYTHONDONTWRITEBYTECODE="1" PYTHONUNBUFFERED="1"
28+
ENV DEBIAN_FRONTEND="noninteractive" \
29+
PYTHONDONTWRITEBYTECODE="1" \
30+
PYTHONUNBUFFERED="1"
2731

2832
RUN apt-get update && \
2933
apt-get install -yqq python3 python3-pip && \
@@ -35,11 +39,13 @@ RUN apt-get update && \
3539

3640
########## TENSORFLOW-GPU ##########
3741

38-
FROM --platform=linux/amd64 tensorflow/tensorflow:${TENSORFLOW_VERSION}-gpu as tensorflow-gpu
42+
FROM --platform=linux/amd64 tensorflow/tensorflow:${TENSORFLOW_VERSION}-gpu AS tensorflow-gpu
3943

4044
ARG TENSORFLOW_VERSION
4145

42-
ENV DEBIAN_FRONTEND="noninteractive" PYTHONDONTWRITEBYTECODE="1" PYTHONUNBUFFERED="1"
46+
ENV DEBIAN_FRONTEND="noninteractive" \
47+
PYTHONDONTWRITEBYTECODE="1" \
48+
PYTHONUNBUFFERED="1"
4349

4450
RUN apt-get update && \
4551
apt-get install -yqq python3 python3-pip && \
@@ -68,10 +74,92 @@ RUN apt-get update && \
6874
# are for arm64-based Mac OS only (no Linux wheels available).
6975

7076

77+
########## COMMON BASE FOR NON-TENSORFLOW MULTI-ARCH BUILDS ##########
78+
79+
FROM python:3.10-slim AS steinbock-base
80+
81+
ARG TARGETARCH
82+
ARG STEINBOCK_VERSION
83+
ARG FIXUID_VERSION
84+
ARG TZ="Europe/Zurich"
85+
86+
ENV DEBIAN_FRONTEND="noninteractive" \
87+
PYTHONDONTWRITEBYTECODE="1" \
88+
PYTHONUNBUFFERED="1" \
89+
XDG_RUNTIME_DIR="/tmp"
90+
91+
RUN apt-get update && \
92+
apt-get install -yqq --no-install-recommends \
93+
build-essential \
94+
curl \
95+
git \
96+
locales \
97+
python3-dev \
98+
python3-venv \
99+
mesa-utils \
100+
libgl1 \
101+
libglib2.0-0 \
102+
libfontconfig1 \
103+
libxrender1 \
104+
libdbus-1-3 \
105+
libxkbcommon-x11-0 \
106+
libxi6 \
107+
libxcb-icccm4 \
108+
libxcb-image0 \
109+
libxcb-keysyms1 \
110+
libxcb-randr0 \
111+
libxcb-render-util0 \
112+
libxcb-xinerama0 \
113+
libxcb-xinput0 \
114+
libxcb-xfixes0 \
115+
libxcb-shape0 \
116+
tzdata && \
117+
rm -rf /var/lib/apt/lists/* && \
118+
python -m pip install --upgrade pip setuptools wheel
119+
120+
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen
121+
ENV LANG="en_US.UTF-8" LANGUAGE="en_US:en" LC_ALL="en_US.UTF-8"
122+
RUN ln -snf "/usr/share/zoneinfo/${TZ}" /etc/localtime && echo "${TZ}" > /etc/timezone
123+
124+
RUN addgroup --gid 1000 steinbock && \
125+
adduser --uid 1000 --ingroup steinbock --disabled-password --gecos "" steinbock
126+
127+
RUN mkdir /data && chown steinbock:steinbock /data
128+
129+
ENV RUN_FIXUID=1
130+
RUN case "${TARGETARCH}" in \
131+
amd64) FIXUID_ARCH="amd64" ;; \
132+
arm64) FIXUID_ARCH="arm64" ;; \
133+
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" && exit 1 ;; \
134+
esac && \
135+
curl -SsL "https://github.com/boxboat/fixuid/releases/download/v${FIXUID_VERSION}/fixuid-${FIXUID_VERSION}-linux-${FIXUID_ARCH}.tar.gz" | tar -C /usr/local/bin -xzf - && \
136+
chmod 4755 /usr/local/bin/fixuid && \
137+
mkdir -p /etc/fixuid
138+
COPY --chown=root:root fixuid.yml /etc/fixuid/config.yml
139+
140+
RUN python3 -m venv --system-site-packages /opt/steinbock-venv
141+
ENV ROOT_VENV_PATH="${PATH}" \
142+
STEINBOCK_VENV_PATH="/opt/steinbock-venv/bin:${PATH}" \
143+
PATH="/opt/steinbock-venv/bin:${PATH}" \
144+
TF_CPP_MIN_LOG_LEVEL="2" \
145+
NO_AT_BRIDGE="1"
146+
147+
COPY --chown=root:root steinbock /app/steinbock/steinbock/
148+
COPY --chown=root:root requirements.txt requirements_test.txt conftest.py MANIFEST.in pyproject.toml setup.cfg /app/steinbock/
149+
150+
RUN python -m pip install -r /app/steinbock/requirements.txt && \
151+
python -m pip install -r /app/steinbock/requirements_test.txt && \
152+
python -m pip install jupyter jupyterlab
153+
154+
COPY --chown=root:root entrypoint.sh /app/entrypoint.sh
155+
156+
157+
71158
########## STEINBOCK ##########
72159

73160
FROM ${TENSORFLOW_TARGET} AS steinbock
74161

162+
ARG TARGETARCH
75163
ARG STEINBOCK_VERSION
76164
ARG FIXUID_VERSION
77165
ARG ILASTIK_BINARY
@@ -80,7 +168,10 @@ ARG CELLPROFILER_PLUGINS_VERSION
80168
ARG CELLPOSE_VERSION
81169
ARG TZ="Europe/Zurich"
82170

83-
ENV DEBIAN_FRONTEND="noninteractive" PYTHONDONTWRITEBYTECODE="1" PYTHONUNBUFFERED="1" XDG_RUNTIME_DIR="/tmp"
171+
ENV DEBIAN_FRONTEND="noninteractive" \
172+
PYTHONDONTWRITEBYTECODE="1" \
173+
PYTHONUNBUFFERED="1" \
174+
XDG_RUNTIME_DIR="/tmp"
84175

85176
# install system packages
86177

@@ -108,9 +199,14 @@ RUN mkdir /data && \
108199
# install fixuid
109200

110201
ENV RUN_FIXUID=1
111-
RUN USER=steinbock && \
202+
RUN case "${TARGETARCH}" in \
203+
amd64) FIXUID_ARCH="amd64" ;; \
204+
arm64) FIXUID_ARCH="arm64" ;; \
205+
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" && exit 1 ;; \
206+
esac && \
207+
USER=steinbock && \
112208
GROUP=steinbock && \
113-
curl -SsL "https://github.com/boxboat/fixuid/releases/download/v${FIXUID_VERSION}/fixuid-${FIXUID_VERSION}-linux-amd64.tar.gz" | tar -C /usr/local/bin -xzf - && \
209+
curl -SsL "https://github.com/boxboat/fixuid/releases/download/v${FIXUID_VERSION}/fixuid-${FIXUID_VERSION}-linux-${FIXUID_ARCH}.tar.gz" | tar -C /usr/local/bin -xzf - && \
114210
chmod 4755 /usr/local/bin/fixuid && \
115211
mkdir -p /etc/fixuid
116212
COPY --chown=root:root fixuid.yml /etc/fixuid/config.yml
@@ -121,6 +217,7 @@ RUN mkdir /opt/ilastik && \
121217
curl -SsL "https://files.ilastik.org/${ILASTIK_BINARY}" | tar -C /opt/ilastik -xjf - --strip-components=1
122218

123219
# install cellprofiler in cellprofiler-venv
220+
# kept amd64-only because this whole image is tensorflow/amd64-based anyway
124221

125222
RUN python3 -m venv --system-site-packages /opt/cellprofiler-venv
126223
ENV ROOT_VENV_PATH="${PATH}" CELLPROFILER_VENV_PATH="/opt/cellprofiler-venv/bin:${PATH}"
@@ -161,7 +258,9 @@ RUN python -m pip install -r /app/steinbock/requirements.txt && \
161258
python -m pip install jupyter jupyterlab
162259
ENV TF_CPP_MIN_LOG_LEVEL="2" NO_AT_BRIDGE="1"
163260

164-
RUN --mount=source=.git,target=/app/steinbock/.git SETUPTOOLS_SCM_PRETEND_VERSION="${STEINBOCK_VERSION#v}" python -m pip install -e "/app/steinbock[imc,deepcell,napari]"
261+
RUN --mount=source=.git,target=/app/steinbock/.git \
262+
SETUPTOOLS_SCM_PRETEND_VERSION="${STEINBOCK_VERSION#v}" \
263+
python -m pip install -e "/app/steinbock[imc,deepcell,napari]"
165264

166265
RUN mkdir -p /opt/keras/models && \
167266
curl -SsL https://deepcell-data.s3-us-west-1.amazonaws.com/saved-models/MultiplexSegmentation-9.tar.gz | tar -C /opt/keras/models -xzf -
@@ -178,17 +277,31 @@ EXPOSE 8888
178277

179278
########## STEINBOCK-CELLPOSE ##########
180279

181-
FROM steinbock AS steinbock-cellpose
280+
FROM steinbock-base AS steinbock-cellpose
182281

282+
ARG STEINBOCK_VERSION
183283
ARG CELLPOSE_VERSION
184284

185-
USER root:root
285+
ENV PATH="/opt/steinbock-venv/bin:${PATH}"
286+
287+
# install steinbock without tensorflow/deepcell extras
288+
RUN --mount=source=.git,target=/app/steinbock/.git \
289+
SETUPTOOLS_SCM_PRETEND_VERSION="${STEINBOCK_VERSION#v}" \
290+
python -m pip install -e "/app/steinbock[imc,napari]"
291+
292+
# install cellpose natively per architecture
186293
RUN python -m pip install "cellpose==${CELLPOSE_VERSION}"
187-
USER steinbock:steinbock
188294

295+
USER root:root
189296
RUN mkdir -p /home/steinbock/.cellpose/models && \
190297
curl -L -sS -o /home/steinbock/.cellpose/models/cpsam \
191-
https://huggingface.co/mouseland/cellpose-sam/resolve/main/cpsam
298+
https://huggingface.co/mouseland/cellpose-sam/resolve/main/cpsam && \
299+
chown -R steinbock:steinbock /home/steinbock/.cellpose
300+
301+
WORKDIR /data
302+
USER steinbock:steinbock
303+
ENTRYPOINT ["/app/entrypoint.sh"]
304+
EXPOSE 8888
192305

193306

194307

@@ -223,4 +336,4 @@ CMD test ${RUN_FIXUID} && eval $( fixuid -q ); \
223336
echo "Launching steinbock on Xpra; connect via http://localhost:${XPRA_PORT}"; \
224337
xpra start --daemon=no --uid=$(id -u) --gid=$(id -g) --bind-tcp="0.0.0.0:${XPRA_PORT}" --start-child="${XPRA_START}" --exit-with-children=yes --exit-with-client=yes --xvfb="/usr/bin/Xvfb +extension Composite -screen 0 ${XPRA_XVFB_SCREEN} -nolisten tcp -noreset" --html=on --notifications=no --bell=no --webcam=no --pulseaudio=no ${DISPLAY}
225338
ENTRYPOINT []
226-
EXPOSE 8888 ${XPRA_PORT}
339+
EXPOSE 8888 ${XPRA_PORT}

0 commit comments

Comments
 (0)