From 68364cbba1e9dc146cc286c0c04f759659d51090 Mon Sep 17 00:00:00 2001 From: Tasko Olevski Date: Mon, 25 Nov 2024 11:47:25 +0100 Subject: [PATCH] squashme: use micromamba to install conda --- .../workflows/build-and-push-to-docker.yml | 21 ++++++++++++------- docker/vscode/conda.Dockerfile | 19 +++++++++++------ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-and-push-to-docker.yml b/.github/workflows/build-and-push-to-docker.yml index ecb9a4f0..82e5c2ab 100644 --- a/.github/workflows/build-and-push-to-docker.yml +++ b/.github/workflows/build-and-push-to-docker.yml @@ -756,10 +756,15 @@ jobs: fail-fast: true matrix: include: - - CONDA_VERSION: 24.9.2-0 + - PYTHON_VERSION: 3.12.7 BASE_IMAGE_TAG: debian - - CONDA_VERSION: latest + LATEST: true + - PYTHON_VERSION: 3.11.10 + BASE_IMAGE_TAG: debian + LATEST: true + - PYTHON_VERSION: 3.10.15 BASE_IMAGE_TAG: debian + LATEST: true steps: - name: Docker Login uses: docker/login-action@v3 @@ -781,11 +786,11 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ${{ env.DOCKER_PREFIX }}-vscode-conda + images: ${{ env.DOCKER_PREFIX }}-vscode-python tags: | - type=sha,prefix=${{ matrix.CONDA_VERSION }}- - type=semver,pattern={{version}},prefix=${{ matrix.CONDA_VERSION }}- - type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && matrix.CONDA_VERSION == 'latest' }} + type=sha,prefix=py-${{ matrix.PYTHON_VERSION }}- + type=semver,pattern={{version}},prefix=py-${{ matrix.PYTHON_VERSION }}- + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && matrix.LATEST }} - name: Build and export uses: docker/build-push-action@v6 with: @@ -906,8 +911,8 @@ jobs: with: images: ${{ env.DOCKER_PREFIX }}-vscode-r tags: | - type=sha,prefix=${{ matrix.R_VERSION }}- - type=semver,pattern={{version}},prefix=${{ matrix.R_VERSION }}- + type=sha,prefix=r-${{ matrix.R_VERSION }}- + type=semver,pattern={{version}},prefix=r-${{ matrix.R_VERSION }}- type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && matrix.LATEST }} - name: Build and export uses: docker/build-push-action@v6 diff --git a/docker/vscode/conda.Dockerfile b/docker/vscode/conda.Dockerfile index 5145bc77..6516add8 100644 --- a/docker/vscode/conda.Dockerfile +++ b/docker/vscode/conda.Dockerfile @@ -1,20 +1,27 @@ ARG BASE_IMAGE=renku/renkulab-vscode:latest FROM $BASE_IMAGE -ARG MINIFORGE_VERSION=24.9.2-0 -ARG OS=Linux -ARG ARCH=x86_64 +ARG MICROMAMBA_VERSION=2.0.2-2 +ARG MAMBA_VERSION=1.5.9 +ARG CONDA_VERSION=24.9.2 +ARG PYTHON_VERSION=3.12.7 +ARG OS=linux +ARG ARCH=64 ARG SESSION_USER=vscode ARG WORKDIR=/home/${SESSION_USER}/work ARG VENVS_PATH=${WORKDIR}/.venvs -ENV VENVS_PATH=${VENVS_PATH} +ENV __VENVS_PATH__=${VENVS_PATH} +ENV __PYTHON_VERSION__=${PYTHON_VERSION} +ENV __MAMBA_VERSION__=${MAMBA_VERSION} +ENV __CONDA_VERSION__=${CONDA_VERSION} SHELL [ "/bin/bash", "-c", "-o", "pipefail" ] USER root RUN apt-get update && \ apt-get install -y curl --no-install-recommends && \ - curl -L "https://github.com/conda-forge/miniforge/releases/download/${MINIFORGE_VERSION}/Miniforge3-${OS}-${ARCH}.sh" -o /install.sh && \ + curl -L "https://github.com/mamba-org/micromamba-releases/releases/download/${MICROMAMBA_VERSION}/micromamba-${OS}-${ARCH}" -o /usr/local/bin/micromamba && \ + chmod a+x /usr/local/bin/micromamba && \ rm -rf /var/lib/apt/lists/* USER ${SESSION_USER} WORKDIR ${WORKDIR} ENTRYPOINT ["tini", "--", "sh", "-c"] -CMD ["bash /install.sh -b -u -p ${VENVS_PATH} && ${VENVS_PATH}/bin/conda init && bash /entrypoint.sh"] +CMD ["set -ex && micromamba install --yes --root-prefix=${__VENVS_PATH__} --prefix=${__VENVS_PATH__} python=${__PYTHON_VERSION__} mamba=${__MAMBA_VERSION__} conda=${__CONDA_VERSION__} && ${__VENVS_PATH__}/bin/mamba init && ${__VENVS_PATH__}/bin/conda config --add channels conda-forge && ${__VENVS_PATH__}/bin/conda config --set channel_priority strict && bash /entrypoint.sh"]