|
| 1 | +# Specify the base image to support multi-arch images, such as |
| 2 | +# - 'quay.io/condaforge/linux-anvil-aarch64' for Linux aarch64 |
| 3 | +# - 'quay.io/condaforge/linux-anvil-cos7-x86_64' for Linux x86_64 |
| 4 | +ARG BASE_IMAGE=quay.io/condaforge/linux-anvil-aarch64 |
| 5 | + |
| 6 | +FROM quay.io/condaforge/linux-anvil-aarch64 as base |
| 7 | + |
| 8 | +# Copy over C.UTF-8 locale from our base image to make it consistently available during build. |
| 9 | +COPY --from=quay.io/bioconda/base-glibc-busybox-bash /usr/lib/locale/C.UTF-8 /usr/lib/locale/C.UTF-8 |
| 10 | + |
| 11 | +# Provide system deps unconditionally until we are able to offer per-recipe installs. |
| 12 | +# (Addresses, e.g., "ImportError: libGL.so.1" in tests directly invoked by conda-build.) |
| 13 | +# Also install packages that have been installed historically (openssh-client). |
| 14 | +RUN yum install -y mesa-libGL-devel \ |
| 15 | + && \ |
| 16 | + yum install -y openssh-clients \ |
| 17 | + && \ |
| 18 | + yum clean all && \ |
| 19 | + rm -rf /var/cache/yum/* |
| 20 | + |
| 21 | +# This changes root's .condarc which ENTRYPOINT copies to /home/conda/.condarc later. |
| 22 | +RUN . /opt/conda/etc/profile.d/conda.sh && \ |
| 23 | + conda config \ |
| 24 | + --prepend channels defaults \ |
| 25 | + --prepend channels bioconda \ |
| 26 | + --prepend channels conda-forge \ |
| 27 | + && \ |
| 28 | + { conda config --remove repodata_fns current_repodata.json 2> /dev/null || true ; } && \ |
| 29 | + conda config --prepend repodata_fns repodata.json && \ |
| 30 | + conda config --set channel_priority flexible && \ |
| 31 | + conda config --set auto_update_conda False |
| 32 | + |
| 33 | +FROM base as build |
| 34 | +WORKDIR /tmp/repo |
| 35 | +COPY . ./ |
| 36 | +RUN . /opt/conda/etc/profile.d/conda.sh && conda list |
| 37 | +RUN . /opt/conda/etc/profile.d/conda.sh && conda activate base && \ |
| 38 | + pip wheel . && \ |
| 39 | + mkdir - /opt/bioconda-utils && \ |
| 40 | + cp ./bioconda_utils-*.whl \ |
| 41 | + ./bioconda_utils/bioconda_utils-requirements.txt \ |
| 42 | + /opt/bioconda-utils/ \ |
| 43 | + && \ |
| 44 | + chgrp -R lucky /opt/bioconda-utils && \ |
| 45 | + chmod -R g=u /opt/bioconda-utils |
| 46 | + |
| 47 | +# It's for multi-arch support. We do runtime involucro build here to solve |
| 48 | +# the chicken-and-egg conundrum. See also: |
| 49 | +# https://github.com/bioconda/bioconda-recipes/pull/40144 |
| 50 | +FROM golang as involucro_build |
| 51 | +RUN wget https://github.com/involucro/involucro/archive/v1.1.2.tar.gz && \ |
| 52 | + tar -zxvf v1.1.2.tar.gz && \ |
| 53 | + mkdir -p src/github.com/involucro/ && \ |
| 54 | + mv involucro-1.1.2/ src/github.com/involucro/involucro && \ |
| 55 | + module_path="$( go env GOPATH )"/src/github.com/involucro/involucro/cmd/involucro && \ |
| 56 | + GO111MODULE=auto GOBIN="$( go env GOBIN )" go build -o ./bin/involucro -ldflags="-s -X github.com/involucro/involucro/app.version=1.1.2" "${module_path}" |
| 57 | + |
| 58 | +FROM base |
| 59 | +COPY --from=build /opt/bioconda-utils /opt/bioconda-utils |
| 60 | +COPY --from=involucro_build /go/bin/involucro /opt/conda/bin/ |
| 61 | +RUN . /opt/conda/etc/profile.d/conda.sh && conda activate base && \ |
| 62 | + # Make sure we get the (working) conda we want before installing the rest. |
| 63 | + sed -nE \ |
| 64 | + '/^conda([><!=~ ].+)?$/p' \ |
| 65 | + /opt/bioconda-utils/bioconda_utils-requirements.txt \ |
| 66 | + | xargs -r conda install --yes && \ |
| 67 | + # Remove involucro line, build it in involucro_build stage |
| 68 | + sed -i '/^involucro/d' /opt/bioconda-utils/bioconda_utils-requirements.txt && \ |
| 69 | + conda install --yes --file /opt/bioconda-utils/bioconda_utils-requirements.txt && \ |
| 70 | + pip install --no-deps --find-links /opt/bioconda-utils bioconda_utils && \ |
| 71 | + conda clean --yes --index --tarballs && \ |
| 72 | + # Find files that are not already in group "lucky" and change their group and mode. |
| 73 | + find /opt/conda \ |
| 74 | + \! -group lucky \ |
| 75 | + -exec chgrp --no-dereference lucky {} + \ |
| 76 | + \! -type l \ |
| 77 | + -exec chmod g=u {} + |
| 78 | + |
0 commit comments