From 141a83208d40c2feece6f9fe67447b7dbe0febaf Mon Sep 17 00:00:00 2001 From: Tao Sun Date: Thu, 12 Aug 2021 12:07:57 +0200 Subject: [PATCH] feat: add base image for batch execution (#173) #172 --- .../workflows/build_and_push_to_docker.yml | 28 +++++++++++++++ docker/batch/Dockerfile | 34 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 docker/batch/Dockerfile diff --git a/.github/workflows/build_and_push_to_docker.yml b/.github/workflows/build_and_push_to_docker.yml index ec259fb6..a499f512 100644 --- a/.github/workflows/build_and_push_to_docker.yml +++ b/.github/workflows/build_and_push_to_docker.yml @@ -71,6 +71,34 @@ jobs: EXTENSION: ${{ matrix.EXTENSIONS }} DOCKER_NAME: "renku/renkulab" + build-py-batch: + needs: build-py + runs-on: ubuntu-latest + + steps: + - name: Docker Login + uses: Azure/docker-login@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - uses: actions/checkout@v2 + - name: Build renku project python-based docker image for batch execution + run: | + if [[ ${{ github.ref }} == refs/tags* ]]; then + export LABEL=$(echo ${{ github.ref }} | cut -d / -f 3) + else + export LABEL=$(echo ${{ github.sha }} | cut -c 1-7) + fi + + docker build docker/batch \ + --build-arg RENKU_BASE="$DOCKER_NAME-py:3.9-$LABEL" \ + --build-arg BASE_IMAGE="python:3.9-slim" \ + --tag $DOCKER_NAME-batch:$LABEL + docker push $DOCKER_NAME-batch:$LABEL + env: + DOCKER_NAME: "renku/renkulab" + build-julia-ext: needs: build-py runs-on: ubuntu-latest diff --git a/docker/batch/Dockerfile b/docker/batch/Dockerfile new file mode 100644 index 00000000..2ecbda5d --- /dev/null +++ b/docker/batch/Dockerfile @@ -0,0 +1,34 @@ +# define build arguments +ARG RENKU_BASE=renku/renkulab-py:latest +ARG BASE_IMAGE=python:3.9-slim + +# define base images +FROM $RENKU_BASE as renku_base +FROM $BASE_IMAGE + +LABEL maintainer="Swiss Data Science Center " + +# install dependencies +RUN apt-get update -y && \ + apt-get install -y curl && \ + curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \ + apt-get update -y && \ + apt-get install -y git git-lfs nodejs && \ + apt-get purge && \ + apt-get clean && \ + apt autoremove --yes && \ + rm -rf /var/lib/apt/lists/* + +RUN pip install pipx + +# override default locations of pipx and app installation +ENV PIPX_BIN_DIR /share/bin +ENV PIPX_HOME /share/pipx +ENV PATH /share/bin:$PATH + +# install renku-python +RUN pipx install --pip-args="--no-cache" renku + +# inject entrypoint.sh +COPY --from=renku_base /entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file