Skip to content

Commit 48377be

Browse files
authored
fix docker build (#709)
* fix docker Signed-off-by: Intron7 <severin.dicks@icloud.com> * next fix Signed-off-by: Intron7 <severin.dicks@icloud.com> --------- Signed-off-by: Intron7 <severin.dicks@icloud.com>
1 parent 701094e commit 48377be

3 files changed

Lines changed: 23 additions & 17 deletions

File tree

.github/workflows/docker.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,17 @@ jobs:
101101
with:
102102
ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || '' }}
103103

104+
- name: Set source package version
105+
id: source-version
106+
run: |
107+
if [[ "${GITHUB_EVENT_NAME}" == "release" ]]; then
108+
VERSION="${GITHUB_REF_NAME#v}"
109+
else
110+
VERSION="0.0.0.dev0+g$(git rev-parse --short=12 HEAD)"
111+
fi
112+
echo "version=${VERSION}" >> "${GITHUB_OUTPUT}"
113+
shell: bash
114+
104115
- name: Set pending status on PR
105116
if: github.event_name == 'issue_comment'
106117
run: |
@@ -142,8 +153,9 @@ jobs:
142153
labels: ${{ steps.meta-base.outputs.labels }}
143154
build-args: |
144155
CUDA_VER=${{ matrix.CUDA_SUFFIX.ver }}
145-
GIT_ID=${{ github.event.pull_request.head.sha || github.sha }}
146156
#cache-from: type=registry,ref=ghcr.io/${{ github.repository }}-deps
157+
build-contexts: |
158+
source=.
147159
148160
- name: Generate artifact attestation for base image
149161
if: github.event_name == 'release'
@@ -171,10 +183,11 @@ jobs:
171183
labels: ${{ steps.meta.outputs.labels }}
172184
build-args: |
173185
CUDA_ARCHS=${{ matrix.CUDA_SUFFIX.label == 'cuda12' && '75-real;80-real;86-real;89-real;90' || '75-real;80-real;86-real;89-real;90-real;100-real;120' }}
174-
GIT_ID=${{ github.event.pull_request.head.sha || github.sha }}
186+
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_RAPIDS_SINGLECELL=${{ steps.source-version.outputs.version }}
175187
#cache-from: type=registry,ref=ghcr.io/${{ github.repository }}
176188
build-contexts: |
177189
rapids-singlecell-deps=docker-image://${{ fromJSON(steps.meta-base.outputs.json).tags[0] }}
190+
source=.
178191
179192
- name: Generate artifact attestation for main image
180193
if: github.event_name == 'release'

docker/Dockerfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
FROM rapids-singlecell-deps
22

3-
ARG GIT_ID=main
4-
53
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
64

75
ENV PATH=/opt/conda/bin:$PATH
@@ -11,15 +9,15 @@ ENV PATH=/opt/conda/bin:$PATH
119
# pick up the CUDA-matched librmm instead of a mismatched PyPI wheel.
1210
ENV CMAKE_PREFIX_PATH=/opt/conda
1311
ARG CUDA_ARCHS="75-real;80-real;86-real;89-real;90-real;100-real;120"
12+
ARG SETUPTOOLS_SCM_PRETEND_VERSION_FOR_RAPIDS_SINGLECELL=0.0.0
13+
14+
COPY --from=source . /src/rapids_singlecell
1415

1516
RUN <<EOF
1617
# install rapids_singlecell from source (compiled for all supported GPU architectures)
1718
set -x
18-
mkdir /src
19-
cd /src
20-
git clone https://github.com/scverse/rapids_singlecell.git
21-
cd rapids_singlecell
22-
git checkout ${GIT_ID}
19+
export SETUPTOOLS_SCM_PRETEND_VERSION_FOR_RAPIDS_SINGLECELL
20+
cd /src/rapids_singlecell
2321
# Set CUDA architectures directly in pyproject.toml (avoids SKBUILD_CMAKE_ARGS semicolon splitting)
2422
sed -i 's/CMAKE_CUDA_ARCHITECTURES = "native"/CMAKE_CUDA_ARCHITECTURES = "'"${CUDA_ARCHS}"'"/' pyproject.toml
2523
grep CMAKE_CUDA_ARCHITECTURES pyproject.toml

docker/Dockerfile.deps

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ ENV PYTHON_VERSION=${PYTHON_VER}
1515
COPY --from=condaforge/miniforge3:26.1.1-3 /opt/conda /opt/conda
1616

1717
COPY rsc_rapids.yml rsc_rapids.yml
18+
COPY --from=source pyproject.toml /tmp/rapids_singlecell_pyproject.toml
1819

19-
ARG GIT_ID=main
2020
ARG DEBIAN_FRONTEND=noninteractive
2121

2222
RUN <<EOF
2323
# install system dependencies
2424
set -x
2525
apt-get -qq update
2626
apt-get -q -o=Dpkg::Use-Pty=0 -y dist-upgrade
27-
apt-get -q install -y -o=Dpkg::Use-Pty=0 git
2827
apt-get -q clean -y
2928
rm -rf /var/lib/apt/lists/*
3029
EOF
@@ -75,17 +74,13 @@ EOF
7574
RUN <<EOF
7675
# install rapids_singlecell pip dependencies (without building the package)
7776
set -x
78-
cd /tmp
79-
git clone https://github.com/scverse/rapids_singlecell.git
80-
cd rapids_singlecell
81-
git checkout ${GIT_ID}
8277
/opt/conda/bin/python -c "
8378
import tomllib
84-
with open('pyproject.toml', 'rb') as f:
79+
with open('/tmp/rapids_singlecell_pyproject.toml', 'rb') as f:
8580
data = tomllib.load(f)
8681
with open('/tmp/deps.txt', 'w') as f:
8782
f.write('\n'.join(data['project']['dependencies']))
8883
"
8984
/opt/conda/bin/python -m pip install --no-cache-dir -r /tmp/deps.txt
90-
rm -rf /tmp/rapids_singlecell /tmp/deps.txt
85+
rm -f /tmp/rapids_singlecell_pyproject.toml /tmp/deps.txt
9186
EOF

0 commit comments

Comments
 (0)