diff --git a/dockerfiles/conda-builder/Dockerfile b/dockerfiles/conda-builder/Dockerfile index d3ef628356855d0b7a325938b5714cca026d51d8..29f86c2484af4effeb4f1020d4da06887e1748f6 100644 --- a/dockerfiles/conda-builder/Dockerfile +++ b/dockerfiles/conda-builder/Dockerfile @@ -23,30 +23,27 @@ RUN yum -y update \ RUN curl -L https://github.com/conda-forge/miniforge/releases/download/4.11.0-0/Mambaforge-4.11.0-0-Linux-x86_64.sh -o mambaforge.sh \ && bash mambaforge.sh -b -p ${CONDA_INSTALL_DIR} \ && rm mambaforge.sh \ - && ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh \ - && source /opt/conda/etc/profile.d/conda.sh \ - && conda activate \ - && conda config --set show_channel_urls True \ - && conda config --set channel_priority strict \ + && ${CONDA_INSTALL_DIR}/bin/conda config --set show_channel_urls True \ + && ${CONDA_INSTALL_DIR}/bin/conda config --set channel_priority strict \ # There are just too many packages that clobber paths. So don't set to # path_conflict to `prevent` -- else we'll be overriding this setting to # `warn` in lots of projects. - && conda config --set path_conflict warn \ - && conda config --set notify_outdated_conda false \ + && ${CONDA_INSTALL_DIR}/bin/conda config --set path_conflict warn \ + && ${CONDA_INSTALL_DIR}/bin/conda config --set notify_outdated_conda false \ # Set the variant file to the one from conda-forge-pinning. # The conda-forge-pinning package (installed below) puts its variant # file in $CONDA_INSTALL_DIR. Pointing conda-build to that variant file # ensures we're compiling against libraries compatible with the wider # conda-forge ecosystem. - && conda config --set conda_build.config_file ${CONDA_INSTALL_DIR}/conda_build_config.yaml \ + && ${CONDA_INSTALL_DIR}/bin/conda config --set conda_build.config_file ${CONDA_INSTALL_DIR}/conda_build_config.yaml \ # Explicitly fail when overlinking shared libraries. This will prevent dynamic library linking issues, # and will be the default setting in conda build 4.0 anyway. - && conda config --set conda_build.error_overlinking True \ + && ${CONDA_INSTALL_DIR}/bin/conda config --set conda_build.error_overlinking True \ # Explicitly install a specific build of requests because of a chardet incompability. # See https://github.com/conda-forge/requests-feedstock/pull/54. \ # TODO: when the metadata of the affected requests packages has been patched, # remove the `requests` line. - && conda install --yes --update-all \ + && ${CONDA_INSTALL_DIR}/bin/conda install --yes --update-all \ conda-build \ conda-verify \ mamba \ @@ -55,8 +52,13 @@ RUN curl -L https://github.com/conda-forge/miniforge/releases/download/4.11.0-0/ coverage-fixpaths \ conda-forge-pinning=${CONDA_FORGE_PINNING} \ requests=2.28.0=pyhd8ed1ab_1 \ - && conda clean -tipy \ - && conda-build purge-all + && ${CONDA_INSTALL_DIR}/bin/conda clean -tipy \ + && ${CONDA_INSTALL_DIR}/bin/conda-build purge-all \ + && ${CONDA_INSTALL_DIR}/bin/conda init bash +# Add a shell script that activates conda ... +COPY entrypoint.sh /opt/docker/bin/entrypoint.sh +# ... and make it the Docker entrypoint so that conda is available when we run a container. +ENTRYPOINT [ "/bin/bash", "/opt/docker/bin/entrypoint.sh" ] # Provide a default command (`bash`), which will start if the user doesn't specify one. CMD [ "/bin/bash" ] diff --git a/dockerfiles/conda-builder/entrypoint.sh b/dockerfiles/conda-builder/entrypoint.sh new file mode 100644 index 0000000000000000000000000000000000000000..190be4b75106321f4a564ff4906a9a7e6353b207 --- /dev/null +++ b/dockerfiles/conda-builder/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# GitLab runner doesn't source .bashrc, so we do it ourselves. +. ~/.bashrc + +# Run whatever the user wants to. +exec "$@" \ No newline at end of file