From c420e4eb0b5bdcf3d555eb34e56678b6cbfe6bb2 Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Thu, 13 Jul 2023 11:59:04 -0500 Subject: [PATCH 1/6] Standardize on pyenv for all ubuntu images, add 22.04 image --- ubuntu-20.04/Dockerfile | 31 +++++++++++++------- ubuntu-22.04/Dockerfile | 64 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 11 deletions(-) create mode 100644 ubuntu-22.04/Dockerfile diff --git a/ubuntu-20.04/Dockerfile b/ubuntu-20.04/Dockerfile index d46ea6d..bc3bce2 100644 --- a/ubuntu-20.04/Dockerfile +++ b/ubuntu-20.04/Dockerfile @@ -1,10 +1,12 @@ FROM ubuntu:20.04 +ENV PYENV_ROOT=/root/.pyenv +ENV PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH" + RUN apt-get update && \ DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \ apt-utils \ software-properties-common && \ - add-apt-repository ppa:deadsnakes/ppa -y && \ add-apt-repository ppa:git-core/ppa -y && \ add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \ @@ -17,20 +19,27 @@ RUN apt-get update && \ g++-10 \ git \ jq \ - python3.9 \ - python3.9-venv \ - libpython3.9-dev \ + libbz2-dev \ + libffi-dev \ + liblzma-dev \ + libncursesw5-dev \ + libreadline-dev \ + libssl-dev \ + libsqlite3-dev \ + libxml2-dev \ + libxmlsec1-dev \ sudo \ + tk-dev \ vim \ wget \ + xz-utils \ zlib1g-dev && \ - # Sets up some useful symlinks \ - python3.9 -m ensurepip && \ - ln -sf "$(which python3.9)" /usr/bin/python && \ - ln -sf "$(which python3.9)" /usr/bin/python3 && \ - ln -sf "$(which pip3.9)" /usr/bin/pip && \ - ln -sf "$(which pip3.9)" /usr/bin/pip3 && \ - pip3 install --no-cache-dir py3createtorrent && \ + # Set up pyenv \ + git clone https://github.com/pyenv/pyenv.git ~/.pyenv && \ + pyenv install 3.9 && \ + pyenv global 3.9 && \ + pip install --upgrade pip && \ + pip install --no-cache-dir py3createtorrent && \ rm -rf /var/lib/apt/lists/* # Add nodejs diff --git a/ubuntu-22.04/Dockerfile b/ubuntu-22.04/Dockerfile new file mode 100644 index 0000000..10d1f6b --- /dev/null +++ b/ubuntu-22.04/Dockerfile @@ -0,0 +1,64 @@ +FROM ubuntu:22.04 + +ENV PYENV_ROOT=/root/.pyenv +ENV PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH" + +RUN apt-get update && \ + DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \ + apt-utils \ + gpg \ + gpg-agent \ + software-properties-common && \ + add-apt-repository ppa:git-core/ppa -y && \ + add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ + DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \ + awscli \ + build-essential \ + curl \ + dialog \ + fakeroot \ + g++-12 \ + g++-13 \ + git \ + jq \ + libbz2-dev \ + libffi-dev \ + liblzma-dev \ + libncursesw5-dev \ + libreadline-dev \ + libssl-dev \ + libsqlite3-dev \ + libxml2-dev \ + libxmlsec1-dev \ + sudo \ + tk-dev \ + vim \ + wget \ + xz-utils \ + zlib1g-dev && \ + # Set up pyenv \ + git clone https://github.com/pyenv/pyenv.git ~/.pyenv && \ + pyenv install 3.10 && \ + pyenv global 3.10 && \ + pip install --upgrade pip && \ + pip install --no-cache-dir py3createtorrent && \ + rm -rf /var/lib/apt/lists/* + +# Add nodejs +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \ + apt-get install -y nodejs + +# Newer version of CMAKE +RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null && \ + echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null && \ + apt-get update && \ + apt-get install cmake -y && \ + rm -rf /var/lib/apt/lists/* + +# Add GitHub CLI +RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ + && chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ + && apt update \ + && apt install gh -y From 772b1449329926de54494704c4d29e7eee028f0b Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Fri, 14 Jul 2023 13:06:04 -0500 Subject: [PATCH 2/6] No fail fast on the cuda matrix --- .github/workflows/build-manylinux2014-cuda.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-manylinux2014-cuda.yml b/.github/workflows/build-manylinux2014-cuda.yml index 660b7df..32652e0 100644 --- a/.github/workflows/build-manylinux2014-cuda.yml +++ b/.github/workflows/build-manylinux2014-cuda.yml @@ -22,6 +22,7 @@ jobs: build: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: arch: [aarch64, x86_64] From 962c0c13990cc41366f1bf5a07bf7bbc4e97f8df Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Fri, 14 Jul 2023 16:46:10 -0500 Subject: [PATCH 3/6] Add workflow for building 22.04 --- .github/workflows/build-ubuntu-22.04.yml | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/build-ubuntu-22.04.yml diff --git a/.github/workflows/build-ubuntu-22.04.yml b/.github/workflows/build-ubuntu-22.04.yml new file mode 100644 index 0000000..54d5780 --- /dev/null +++ b/.github/workflows/build-ubuntu-22.04.yml @@ -0,0 +1,28 @@ +name: Build Ubuntu 22.04 Image + +on: + push: + branches: + - main + paths: + - 'ubuntu-22.04/*' + - '.github/workflows/build-ubuntu-22.04.yml' + pull_request: + workflow_dispatch: + schedule: + - cron: '30 12 * * 5' + +concurrency: + # SHA is added to the end if on `main` to let all main workflows run + group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }} + cancel-in-progress: true + +jobs: + build: + uses: Chia-Network/actions/.github/workflows/docker-build.yaml@main + with: + docker-context: "./ubuntu-22.04" + dockerhub_imagename: "chianetwork/ubuntu-22.04-builder" + secrets: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_PAT: ${{ secrets.DOCKERHUB_PAT }} From f99311cd38a32ebbca9a50e091432bc68587667a Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Fri, 14 Jul 2023 16:48:52 -0500 Subject: [PATCH 4/6] Add dockerfile --- .github/workflows/build-ubuntu-22.04.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-ubuntu-22.04.yml b/.github/workflows/build-ubuntu-22.04.yml index 54d5780..db56f66 100644 --- a/.github/workflows/build-ubuntu-22.04.yml +++ b/.github/workflows/build-ubuntu-22.04.yml @@ -22,6 +22,7 @@ jobs: uses: Chia-Network/actions/.github/workflows/docker-build.yaml@main with: docker-context: "./ubuntu-22.04" + dockerfile: "./ubuntu-22.04/Dockerfile" dockerhub_imagename: "chianetwork/ubuntu-22.04-builder" secrets: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} From 34a4045893c9b23f242115ff664e39409c6a6491 Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Fri, 14 Jul 2023 17:14:55 -0500 Subject: [PATCH 5/6] Update 18.04 and 20.04 --- .github/workflows/build-ubuntu-18.04.yml | 56 ++++-------------------- .github/workflows/build-ubuntu-20.04.yml | 56 ++++-------------------- 2 files changed, 16 insertions(+), 96 deletions(-) diff --git a/.github/workflows/build-ubuntu-18.04.yml b/.github/workflows/build-ubuntu-18.04.yml index 41e3c51..aeeb154 100644 --- a/.github/workflows/build-ubuntu-18.04.yml +++ b/.github/workflows/build-ubuntu-18.04.yml @@ -19,51 +19,11 @@ concurrency: jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Docker Context for Buildx - id: buildx-context - run: | - docker context create builders - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - version: latest - endpoint: builders - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ github.token }} - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PAT }} - - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: | - chianetwork/ubuntu-18.04-builder - tags: | - type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }} - type=sha,format=long - - - name: Build Docker Container - uses: docker/build-push-action@v4 - with: - context: ./ubuntu-18.04 - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} + uses: Chia-Network/actions/.github/workflows/docker-build.yaml@main + with: + docker-context: "./ubuntu-18.04" + dockerfile: "./ubuntu-18.04/Dockerfile" + dockerhub_imagename: "chianetwork/ubuntu-18.04-builder" + secrets: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_PAT: ${{ secrets.DOCKERHUB_PAT }} diff --git a/.github/workflows/build-ubuntu-20.04.yml b/.github/workflows/build-ubuntu-20.04.yml index 870a276..34d45db 100644 --- a/.github/workflows/build-ubuntu-20.04.yml +++ b/.github/workflows/build-ubuntu-20.04.yml @@ -19,51 +19,11 @@ concurrency: jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Docker Context for Buildx - id: buildx-context - run: | - docker context create builders - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - version: latest - endpoint: builders - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ github.token }} - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PAT }} - - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: | - chianetwork/ubuntu-20.04-builder - tags: | - type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }} - type=sha,format=long - - - name: Build Docker Container - uses: docker/build-push-action@v4 - with: - context: ./ubuntu-20.04 - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} + uses: Chia-Network/actions/.github/workflows/docker-build.yaml@main + with: + docker-context: "./ubuntu-20.04" + dockerfile: "./ubuntu-20.04/Dockerfile" + dockerhub_imagename: "chianetwork/ubuntu-20.04-builder" + secrets: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_PAT: ${{ secrets.DOCKERHUB_PAT }} From 18262fe8d6014bc138e9f53d38e639988947faeb Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Fri, 14 Jul 2023 17:18:11 -0500 Subject: [PATCH 6/6] Move aptly and centos to the common docker template --- .github/workflows/build-aptly.yml | 56 +++++------------------------ .github/workflows/build-centos7.yml | 39 ++++++-------------- 2 files changed, 18 insertions(+), 77 deletions(-) diff --git a/.github/workflows/build-aptly.yml b/.github/workflows/build-aptly.yml index 4f62ca0..a08884f 100644 --- a/.github/workflows/build-aptly.yml +++ b/.github/workflows/build-aptly.yml @@ -19,51 +19,11 @@ concurrency: jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Docker Context for Buildx - id: buildx-context - run: | - docker context create builders - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - version: latest - endpoint: builders - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ github.token }} - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PAT }} - - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: | - chianetwork/aptly - tags: | - type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }} - type=sha,format=long - - - name: Build Docker Container - uses: docker/build-push-action@v4 - with: - context: ./aptly - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} + uses: Chia-Network/actions/.github/workflows/docker-build.yaml@main + with: + docker-context: "./aptly" + dockerfile: "./aptly/Dockerfile" + dockerhub_imagename: "chianetwork/aptly" + secrets: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_PAT: ${{ secrets.DOCKERHUB_PAT }} diff --git a/.github/workflows/build-centos7.yml b/.github/workflows/build-centos7.yml index 8ae33ae..26ff093 100644 --- a/.github/workflows/build-centos7.yml +++ b/.github/workflows/build-centos7.yml @@ -17,34 +17,15 @@ concurrency: group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }} cancel-in-progress: true + jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PAT }} - - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: | - chianetwork/centos7-builder - tags: | - type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }} - type=sha,format=long - - - name: Build Docker Container - uses: docker/build-push-action@v4 - with: - context: ./centos7 - push: true - tags: ${{ steps.meta.outputs.tags }} + uses: Chia-Network/actions/.github/workflows/docker-build.yaml@main + with: + docker-context: "./centos7" + dockerfile: "./centos7/Dockerfile" + dockerhub_imagename: "chianetwork/centos7-builder" + docker-platforms: linux/amd64 + secrets: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_PAT: ${{ secrets.DOCKERHUB_PAT }}