Skip to content

Commit

Permalink
Python conda runner (#210)
Browse files Browse the repository at this point in the history
* added a first python env at the bottom of the script

* re-ordered

* random change to test build

* edited ref to previous action

* it's not reserved to main branch anymore...

* this should help with matplotlib issue raised by Guillaume
see GEO-BON/bon-in-a-box-pipeline-engine#169 (comment)
  • Loading branch information
jmlord authored Jan 20, 2025
1 parent 1b0c33f commit 9d7506c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/docker_runner-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker, main branch
- name: Extract metadata (tags, labels) for Docker
if: github.ref == 'refs/heads/main'
id: metadata-main
uses: docker/metadata-action@v4
Expand Down Expand Up @@ -53,6 +53,6 @@ jobs:
context: runners
file: runners/conda-dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.metadata-main.outputs.tags || steps.metadata-staging.outputs.tags }}
labels: ${{ steps.metadata-main.outputs.labels || steps.metadata-staging.outputs.labels }}

7 changes: 4 additions & 3 deletions .github/workflows/docker_runner-julia.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Julia Runner, main branch
name: Julia Runner

on:
workflow_dispatch:
Expand Down Expand Up @@ -50,6 +50,7 @@ jobs:
context: runners
file: runners/julia-dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.metadata-main.outputs.tags || steps.metadata-staging.outputs.tags }}
labels: ${{ steps.metadata-main.outputs.labels || steps.metadata-staging.outputs.labels }}


18 changes: 9 additions & 9 deletions runners/conda-dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
FROM condaforge/mambaforge

ADD ./r-environment.yml /data/r-environment.yml

WORKDIR /data


# Setting Time zone (necessary to install cmake, + will persist at runtime)
ENV TZ=Etc/UTC

Expand All @@ -29,6 +25,7 @@ RUN chmod 777 /.condarc
# Permissions cannot be defined at mount time, hence we create empty folder with the appropriate permissions.
RUN mkdir /.cache && mkdir /.cache/conda && chmod a+w /.cache/conda
RUN mkdir /.conda && chmod a+w /.conda
RUN mkdir /.config && chmod a+w /.config
RUN mkdir /r-libs-user && chmod a+w /r-libs-user
RUN mkdir /conda-env-yml && chmod a+w /conda-env-yml

Expand All @@ -39,13 +36,9 @@ RUN echo 'eval "$(conda shell.bash hook)"; source /opt/conda/etc/profile.d/mamba
# See https://stackoverflow.com/a/74017557/3519951
RUN sed -e '/[ -z "$PS1" ] && return/s/^/#/g' -i /root/.bashrc

ADD ./r-environment.yml /data/r-environment.yml
RUN mamba env create -f /data/r-environment.yml

# Hide "error libmamba Could not open lockfile '/opt/conda/pkgs/cache/cache.lock'" when installing manually with non-root user
# That error would not prevent the correct installation, but it looked like it to the user.
RUN chmod -R 777 /opt/conda/pkgs/cache


## ADD CRAN PACKAGES HERE (for packages not found in anaconda.org)
RUN bash --login -c "mamba activate rbase; R -e 'install.packages(c(\"CoordinateCleaner\", \
\"geodata\", \
Expand All @@ -56,4 +49,11 @@ RUN bash --login -c "mamba activate rbase; R -e 'install.packages(c(\"Coordinate
RUN bash --login -c "mamba activate rbase; R -e 'devtools::install_github(\"ReseauBiodiversiteQuebec/stac-catalogue\")'"
RUN bash --login -c "mamba activate rbase; R -e 'devtools::install_github(\"connectscape/Makurhini\")'"

ADD ./python-environment.yml /data/python-environment.yml
RUN mamba env create -f /data/python-environment.yml

# Hide "error libmamba Could not open lockfile '/opt/conda/pkgs/cache/cache.lock'" when installing manually with non-root user
# That error would not prevent the correct installation, but it looked like it to the user.
RUN chmod -R 777 /opt/conda/pkgs/cache

RUN date +"%Y-%m-%d %R" > /version.txt
5 changes: 5 additions & 0 deletions runners/python-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: pythonbase
channels:
- conda-forge
dependencies:
- pystac

0 comments on commit 9d7506c

Please sign in to comment.