Skip to content

Commit

Permalink
feat(build): use github actions to build docker images (#5380)
Browse files Browse the repository at this point in the history
* add workflow to push images using GHA

* add option to choose environment

* fix makefile target for tests

* disable build of images via jenkins x

* run workflow from master only on master

* minor tweak
  • Loading branch information
RafalSkolasinski authored Feb 28, 2024
1 parent a0c2ac4 commit cfe54e2
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 85 deletions.
198 changes: 192 additions & 6 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,204 @@
name: V2 Build docker images
name: Build & Push Docker Images

on:
push:
branches: [ master ]

workflow_dispatch:
inputs:
docker-tag:
description: 'Docker tag for push (e.g. 2.0.0)'
default: 'latest'
required: false

env:
GOLANG_VERSION: 1.20.9

jobs:
placeholder:
name: placeholder
operator:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GOLANG_VERSION }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: ${{ secrets.DOCKER_REGISTRY }}

- name: Set default docker tag for builds from master
id: docker-tag
run: |
USER_INPUT="${{ github.event.inputs.docker-tag }}"
echo "value=${USER_INPUT:-latest}" >> $GITHUB_OUTPUT
- name: Build and push
working-directory: ./operator/
env:
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
VERSION: ${{ steps.docker-tag.outputs.value }}
run: |
make docker-build docker-push
executor:
runs-on: ubuntu-latest
if: github.repository == 'seldonio/seldon-core' # Do not run this on forks.
steps:
- name: Echo Message
run: echo "This is to make workflow available for V2 releases"
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: ${{ secrets.DOCKER_REGISTRY }}

- name: Set default docker tag for builds from master
id: docker-tag
run: |
USER_INPUT="${{ github.event.inputs.docker-tag }}"
echo "value=${USER_INPUT:-latest}" >> $GITHUB_OUTPUT
- name: Build and push
working-directory: ./executor/
env:
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
VERSION: ${{ steps.docker-tag.outputs.value }}
run: |
make docker-build docker-push
rclone-storage-initializer:
runs-on: ubuntu-latest
steps:
- name: Checkout Git Commit
uses: actions/checkout@v4

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: ${{ secrets.DOCKER_REGISTRY }}

- name: Set default docker tag for builds from master
id: docker-tag
run: |
USER_INPUT="${{ github.event.inputs.docker-tag }}"
echo "value=${USER_INPUT:-latest}" >> $GITHUB_OUTPUT
- name: Build and push (Rclone Storage Initializer)
working-directory: ./components/rclone-storage-initializer
env:
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
VERSION: ${{ steps.docker-tag.outputs.value }}
run: |
make docker-build docker-push
s2i-wrapper:
runs-on: ubuntu-latest
steps:
- name: Checkout Git Commit
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: ${{ secrets.DOCKER_REGISTRY }}

- name: Set default docker tag for builds from master
id: docker-tag
run: |
USER_INPUT="${{ github.event.inputs.docker-tag }}"
echo "value=${USER_INPUT:-latest}" >> $GITHUB_OUTPUT
- name: Build and push (Conda Base Image)
working-directory: ./wrappers/s2i/python
env:
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
VERSION: ${{ steps.docker-tag.outputs.value }}
run: |
make docker-build-conda-base docker-push-conda-base
- name: Build and push (Base Wrapper)
working-directory: ./wrappers/s2i/python
env:
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
VERSION: ${{ steps.docker-tag.outputs.value }}
run: |
make docker-build docker-push PYTHON_VERSION=3.8.10
make docker-tag-base-python docker-push-base-python PYTHON_VERSION=3.8.10
docker save -o /tmp/base-wrapper.tar ${DOCKER_REGISTRY}/seldon-core-s2i-python38:${VERSION}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: base-wrapper
path: /tmp/base-wrapper.tar

prepackaged-components:
runs-on: ubuntu-latest
needs: s2i-wrapper
strategy:
matrix:
server:
- servers/sklearnserver
- servers/xgboostserver
- servers/mlflowserver
- servers/tfserving_proxy
- components/alibi-explain-server
- components/alibi-detect-server
steps:
- name: Checkout Git Commit
uses: actions/checkout@v4

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: ${{ secrets.DOCKER_REGISTRY }}

- name: Set default docker tag for builds from master
id: docker-tag
run: |
USER_INPUT="${{ github.event.inputs.docker-tag }}"
echo "value=${USER_INPUT:-latest}" >> $GITHUB_OUTPUT
- name: Install CLI tools from OpenShift Mirror
uses: redhat-actions/openshift-tools-installer@v1
with:
github_pat: ${{ github.token }}
source: "github"
s2i: "latest"

- name: Download artifact
uses: actions/download-artifact@v3
with:
name: base-wrapper
path: /tmp

- name: Load image
run: |
docker load --input /tmp/base-wrapper.tar
- name: Build and push (Prepackaged Server Image)
working-directory: ./${{ matrix.server }}/
env:
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
VERSION: ${{ steps.docker-tag.outputs.value }}
run: |
make docker-build docker-push
78 changes: 0 additions & 78 deletions .lighthouse/jenkins-x/release.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion testing/scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ kind_build_misc:
kind_build_images: build_protos kind_build_operator kind_build_executor kind_build_prepackaged kind_build_alibi_explain kind_build_alibi_detect kind_build_rclone_storage_initializer

.PHONY: kind_build_test_images
kind_build_test_images: make kind_build_test_models kind_build_misc
kind_build_test_images: kind_build_test_models kind_build_misc

.PHONY: helm_setup
helm_setup:
Expand Down

0 comments on commit cfe54e2

Please sign in to comment.