occlum/.github/workflows/build_and_push_ci_image.yml
2020-10-13 16:06:02 +08:00

138 lines
4.2 KiB
YAML

name: Build Image for CI (Manual Trigger)
# For some demos which need a lot of dependencies, building and installing depencies
# during every test consumes much time. Thus, build images specific for these demos.
# Now only gRPC OpenVINO and Python need its own test image. The images are stored in
# "occlumbackup/occlum" dockerhub repo.
# This is a manual trigger.
on:
workflow_dispatch:
inputs:
demo_name:
description: 'demo image name (must choose from <grpc, openvino, python>)'
required: true
default: 'grpc'
tag:
description: 'image tag'
required: true
default: 'latest'
jobs:
Build_grpc_image:
runs-on: ubuntu-18.04
if: github.event.inputs.demo_name == 'grpc'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get occlum version
run: echo ::set-env name=OCCLUM_VERSION::$(grep "Version =" src/pal/include/occlum_version.h | awk '{print $4}')
# Because "Build and push" step `context` field can't be subdir,
# we need to copy files needed by dockerfile to root dir of the project
- name: Copy context for docker build
run: |
cp -r tools/docker .
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./tools/docker/ci/Dockerfile.grpc
platforms: linux/amd64
build-args: OCCLUM_VERSION=${{ env.OCCLUM_VERSION }}
push: true
tags: occlumbackup/occlum:${{ github.event.inputs.tag }}-ubuntu18.04-grpc
Build_openvino_image:
runs-on: ubuntu-18.04
if: github.event.inputs.demo_name == 'openvino'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get occlum version
run: echo ::set-env name=OCCLUM_VERSION::$(grep "Version =" src/pal/include/occlum_version.h | awk '{print $4}')
# Because "Build and push" step `context` field can't be subdir,
# we need to copy files needed by dockerfile to root dir of the project
- name: Copy context for docker build
run: |
cp -r tools/docker .
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./tools/docker/ci/Dockerfile.openvino
platforms: linux/amd64
build-args: OCCLUM_VERSION=${{ env.OCCLUM_VERSION }}
push: true
tags: occlumbackup/occlum:${{ github.event.inputs.tag }}-ubuntu18.04-openvino
Build_python_image:
runs-on: ubuntu-18.04
if: github.event.inputs.demo_name == 'python'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get occlum version
run: echo ::set-env name=OCCLUM_VERSION::$(grep "Version =" src/pal/include/occlum_version.h | awk '{print $4}')
# Because "Build and push" step `context` field can't be subdir,
# we need to copy files needed by dockerfile to root dir of the project
- name: Copy context for docker build
run: |
cp -r tools/docker .
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./tools/docker/ci/Dockerfile.python
platforms: linux/amd64
build-args: OCCLUM_VERSION=${{ env.OCCLUM_VERSION }}
push: true
tags: occlumbackup/occlum:${{ github.event.inputs.tag }}-ubuntu18.04-python