Skip to content

Commit

Permalink
another attempt at removing mamba
Browse files Browse the repository at this point in the history
  • Loading branch information
daler committed Aug 12, 2024
1 parent 46cf321 commit 5d989fc
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ jobs:
wget https://raw.githubusercontent.com/bioconda/bioconda-common/master/{common,install-and-set-up-conda,configure-conda}.sh
bash install-and-set-up-conda.sh
eval "$(conda shell.bash hook)"
mamba create -n bioconda -y --file test-requirements.txt --file bioconda_utils/bioconda_utils-requirements.txt
conda create -n bioconda -y --file test-requirements.txt --file bioconda_utils/bioconda_utils-requirements.txt
conda activate bioconda
python setup.py install
Expand Down
8 changes: 4 additions & 4 deletions images/bioconda-utils-build-env-cos7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ RUN . /opt/conda/etc/profile.d/conda.sh && conda activate base && \
sed -nE \
'/^conda([><!=~ ].+)?$/p' \
/opt/bioconda-utils/bioconda_utils-requirements.txt \
| xargs -r mamba install --yes && \
| xargs -r conda install --yes && \
# FIXME: "remove truststore" only necessary due to python downgrade.
# Updating requirements should fix that.
# (Also this removal will break in future.)
# mamba remove --yes truststore && \
mamba install --yes --file /opt/bioconda-utils/bioconda_utils-requirements.txt && \
# conda remove --yes truststore && \
conda install --yes --file /opt/bioconda-utils/bioconda_utils-requirements.txt && \
pip install --no-deps --find-links /opt/bioconda-utils bioconda_utils && \
mamba clean --yes --index --tarballs && \
conda clean --yes --index --tarballs && \
# Find files that are not already in group "lucky" and change their group and mode.
find /opt/conda \
\! -group lucky \
Expand Down
3 changes: 0 additions & 3 deletions images/create-env/Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ RUN set -x && \
CONDA_PKGS_DIRS="/tmp/pkgs" \
/opt/create-env/env-execute \
create-env \
--conda=mamba \
/usr/local \
file findutils grep
RUN set -x && \
Expand Down Expand Up @@ -34,7 +33,6 @@ FROM "${base}" as build_bioconda_package
RUN set -x && \
/opt/create-env/env-execute \
create-env \
--conda=mamba \
--strip-files=\* \
/usr/local \
python
Expand All @@ -58,7 +56,6 @@ FROM "${base}" as build_conda
RUN set -x && \
/opt/create-env/env-execute \
create-env \
--conda=mamba \
--env-activate-args='--prefix-is-base' \
--strip-files=\* \
--remove-paths=\*.a \
Expand Down
7 changes: 2 additions & 5 deletions images/create-env/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# bioconda/create-env

The `create-env` container image, available as [`quay.io/bioconda/create-env`](https://quay.io/repository/bioconda/create-env?tab=tags), provides [`conda`](https://github.com/conda/conda/) (and [`mamba`](https://github.com/mamba-org/mamba)) alongside a convenience wrapper `create-env` to create small container images based on Conda packages.
The `create-env` container image, available as [`quay.io/bioconda/create-env`](https://quay.io/repository/bioconda/create-env?tab=tags), provides [`conda`](https://github.com/conda/conda/) alongside a convenience wrapper `create-env` to create small container images based on Conda packages.


## Options
Expand Down Expand Up @@ -37,13 +37,12 @@ Post-processing steps are triggered by arguments to `create-env`:
## Usage example:
```Dockerfile
FROM quay.io/bioconda/create-env:2.1.0 as build
# Create an environment containing python=3.9 at /usr/local using mamba, strip
# Create an environment containing python=3.9 at /usr/local, strip
# files and remove some less important files:
RUN export CONDA_ADD_PIP_AS_PYTHON_DEPENDENCY=0 \
&& \
/opt/create-env/env-execute \
create-env \
--conda=mamba \
--strip-files='bin/*' \
--strip-files='lib/*' \
--remove-paths='*.a' \
Expand Down Expand Up @@ -87,8 +86,6 @@ RUN /usr/local/env-activate.sh && python -c 'import sys; print(sys.version)'
```sh
. /opt/create-env/env-activate.sh
export CONDA_ALWAYS_COPY=0
create-env --conda=mamba /opt/python-3.8 python=3.8
create-env --conda=mamba /opt/python-3.9 python=3.9
create-env --conda=: --strip-files=\* /opt/python-3.8
create-env --conda=: --strip-files=\* /opt/python-3.9
```
Expand Down
11 changes: 5 additions & 6 deletions images/create-env/install-conda
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ miniconda_boostrap_prefix="$( pwd )/miniconda"
# Install the base Conda installation.
. "${miniconda_boostrap_prefix}/etc/profile.d/conda.sh"

# Install conda, mamba and some additional tools:
# Install conda and some additional tools:
# - tini: init program,
# - binutils, findutils: tools to strip down image/environment size,

# Only need `strip` executable from binutils. Other binaries from the package
# and especially the "sysroot" dependency is only bloat for this container
# image. (NOTE: The binary needs libgcc-ng which is explicitly added later.)
mamba create --yes \
conda create --yes \
--prefix="${conda_install_prefix}" \
--channel=conda-forge \
binutils
cp -aL "${conda_install_prefix}/bin/strip" ./strip
conda run --prefix="${conda_install_prefix}" strip -- ./strip
mamba remove --yes --all \
conda remove --yes --all \
--prefix="${conda_install_prefix}"

mamba create --yes \
conda create --yes \
--prefix="${conda_install_prefix}" \
--channel=conda-forge \
\
Expand Down Expand Up @@ -116,8 +116,7 @@ conda config \
# This is intentional as it speeds up conda startup time.
conda list --name=base
conda info --all
mamba --version
# Make sure we have the requested conda, mamba versions installed.
# Make sure we have the requested conda version installed, and no mamba
conda list \
--export '^(conda|mamba)$' \
| sed -n 's/=[^=]*$//p' \
Expand Down
6 changes: 0 additions & 6 deletions images/create-env/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,10 @@ CONDA_VERSION=$(
podman run -t $REGISTRY/${BUILD_ENV_IMAGE_NAME}:${BIOCONDA_IMAGE_TAG} \
bash -c "/opt/conda/bin/conda list --export '^conda$'| sed -n 's/=[^=]*$//p'"
)
MAMBA_VERSION=$(
podman run -t $REGISTRY/${BUILD_ENV_IMAGE_NAME}:${BIOCONDA_IMAGE_TAG} \
bash -c "/opt/conda/bin/conda list --export '^mamba$'| sed -n 's/=[^=]*$//p'"
)
# Remove trailing \r with parameter expansion
export CONDA_VERSION=${CONDA_VERSION%$'\r'}
export MAMBA_VERSION=${MAMBA_VERSION%$'\r'}

BUILD_ARGS+=("--build-arg=CONDA_VERSION=$CONDA_VERSION")
BUILD_ARGS+=("--build-arg=MAMBA_VERSION=$MAMBA_VERSION")

# Needs busybox image to copy some items over
if [ $(tag_exists $BASE_BUSYBOX_IMAGE_NAME $BASE_TAG) ]; then
Expand Down

0 comments on commit 5d989fc

Please sign in to comment.