From c63ecc2e10253b18e770a419c9fa17cfa2a4ad71 Mon Sep 17 00:00:00 2001 From: Ravin Kohli Date: Tue, 7 Dec 2021 12:35:02 +0100 Subject: [PATCH 1/3] Add workflow for publishing docker image to github packages and dockerhub --- .github/workflows/docker-publish.yml | 79 ++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 000000000..0705e1e87 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,79 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Publish Docker image + +on: + push: + # Push to `master` or `development` + branches: + - master + - development + - add_docker-publish + +jobs: + push_to_registries: + name: Push Docker image to multiple registries + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + + - name: Log in to Docker Hub + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: | + automlorg/autopytorch + ghcr.io/${{ github.repository }} + + - name: Build and push Docker images + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + push: true + tags: ${{ steps.extract_branch.outputs.branch }} + + - name: Docker Login + run: docker login ghcr.io -u $GITHUB_ACTOR -p $GITHUB_TOKEN + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + + - name: Pull Docker image + run: docker pull ghcr.io/$GITHUB_REPOSITORY/autoPyTorch:$BRANCH + env: + BRANCH: ${{ steps.extract_branch.outputs.branch }} + + - name: Run image + run: docker run -i -d --name unittester -v $GITHUB_WORKSPACE:/workspace -w /workspace ghcr.io/$GITHUB_REPOSITORY/autoPyTorch:$BRANCH + env: + BRANCH: ${{ steps.extract_branch.outputs.branch }} + + - name: Auto-PyTorch loaded + run: docker exec -i unittester python3 -c 'import autoPyTorch; print(f"Auto-PyTorch imported from {autoPyTorch.__file__}")' + + - name: Run unit testing + run: docker exec -i unittester python3 -m pytest -v test \ No newline at end of file From c86c8f9f6d07b981a88af52e1ee22f6c4e5d3ed8 Mon Sep 17 00:00:00 2001 From: Ravin Kohli Date: Tue, 7 Dec 2021 12:46:23 +0100 Subject: [PATCH 2/3] add docker installation to docs --- docs/installation.rst | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/docs/installation.rst b/docs/installation.rst index 44915d75a..9f648c7e5 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -37,5 +37,31 @@ Installing Auto-Pytorch Docker Image -========================= - TODO +============ +A Docker image is also provided on dockerhub. To download from dockerhub, +use: + +.. code:: bash + + docker pull automlorg/autopytorch:master + +You can also verify that the image was downloaded via: + +.. code:: bash + + docker images # Verify that the image was downloaded + +This image can be used to start an interactive session as follows: + +.. code:: bash + + docker run -it automlorg/autopytorch:master + +To start a Jupyter notebook, you could instead run e.g.: + +.. code:: bash + + docker run -it -v ${PWD}:/opt/nb -p 8888:8888 automlorg/autopytorch:master /bin/bash -c "mkdir -p /opt/nb && jupyter notebook --notebook-dir=/opt/nb --ip='0.0.0.0' --port=8888 --no-browser --allow-root" + +Alternatively, it is possible to use the development version of autoPyTorch by replacing all +occurences of ``master`` by ``development``. From e5ba3621dee77877b25de7f0cc05012ba596ad89 Mon Sep 17 00:00:00 2001 From: Ravin Kohli Date: Tue, 7 Dec 2021 14:49:27 +0100 Subject: [PATCH 3/3] add workflow dispatch --- .github/workflows/docker-publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 0705e1e87..b8c5d916e 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -12,6 +12,7 @@ on: - master - development - add_docker-publish + workflow_dispatch: jobs: push_to_registries: