162 lines
5.2 KiB
YAML
162 lines
5.2 KiB
YAML
name: Occlum Docker Build and Push
|
|
|
|
# This is a manual trigger.
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
OS:
|
|
description: 'OS name (must choose from <centos, ubuntu18, ubuntu20>)'
|
|
required: true
|
|
default: 'ubuntu20'
|
|
release:
|
|
description: 'Whether it is a release image (must choose from <Y/N>)'
|
|
required: true
|
|
default: 'N'
|
|
|
|
jobs:
|
|
generate-centos-image:
|
|
# GitHub Actions doesn't have CentOS VM provided
|
|
runs-on: ubuntu-18.04
|
|
if: github.event.inputs.OS == 'centos'
|
|
|
|
steps:
|
|
- name: Prepare tools
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install yum
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Get Occlum release version
|
|
run: echo "RELEASE_VERSION=$(grep 'Version =' src/pal/include/occlum_version.h | awk '{print $4}')" >> $GITHUB_ENV;
|
|
|
|
- name: Get branch name
|
|
# GITHUB_REF=refs/heads/branch-name
|
|
# ${GITHUB_REF##*/} == branch-name
|
|
run: echo "OCCLUM_BRANCH=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV;
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
with:
|
|
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=104857600
|
|
|
|
- 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/Dockerfile.centos8.2
|
|
platforms: linux/amd64
|
|
build-args: OCCLUM_BRANCH=${{ env.OCCLUM_BRANCH }}
|
|
push: true
|
|
tags: occlum/occlum:${{ env.RELEASE_VERSION }}-centos8.2
|
|
|
|
generate-ubuntu18-image:
|
|
runs-on: ubuntu-18.04
|
|
if: github.event.inputs.OS == 'ubuntu18'
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
# 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/toolchains .
|
|
cp -r tools/docker .
|
|
|
|
- name: Get Occlum release version
|
|
run: echo "RELEASE_VERSION=$(grep 'Version =' src/pal/include/occlum_version.h | awk '{print $4}')" >> $GITHUB_ENV;
|
|
|
|
- name: Get branch name
|
|
# GITHUB_REF=refs/heads/branch-name
|
|
# ${GITHUB_REF##*/} == branch-name
|
|
run: echo "OCCLUM_BRANCH=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV;
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
with:
|
|
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=104857600
|
|
|
|
- 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/Dockerfile.ubuntu18.04
|
|
platforms: linux/amd64
|
|
build-args: OCCLUM_BRANCH=${{ env.OCCLUM_BRANCH }}
|
|
push: true
|
|
tags: occlum/occlum:${{ env.RELEASE_VERSION }}-ubuntu18.04
|
|
|
|
generate-ubuntu20-image:
|
|
runs-on: ubuntu-20.04
|
|
if: github.event.inputs.OS == 'ubuntu20'
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
# 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/toolchains .
|
|
cp -r tools/docker .
|
|
|
|
- name: Get Occlum release version
|
|
run: echo "RELEASE_VERSION=$(grep 'Version =' src/pal/include/occlum_version.h | awk '{print $4}')" >> $GITHUB_ENV;
|
|
|
|
- name: Get branch name
|
|
# GITHUB_REF=refs/heads/branch-name
|
|
# ${GITHUB_REF##*/} == branch-name
|
|
run: echo "OCCLUM_BRANCH=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV;
|
|
|
|
- name: Get image tag name for release image
|
|
if: github.event.inputs.release == 'Y'
|
|
run: echo "IMAGE_TAG=${{ env.RELEASE_VERSION }}" >> $GITHUB_ENV
|
|
- name: Get image tage name for dev image
|
|
if: github.event.inputs.release == 'N'
|
|
run: echo "IMAGE_TAG=latest-dev-${GITHUB_SHA:0:7}" >> $GITHUB_ENV
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
with:
|
|
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=104857600
|
|
|
|
- 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/Dockerfile.ubuntu20.04
|
|
platforms: linux/amd64
|
|
build-args: OCCLUM_BRANCH=${{ env.OCCLUM_BRANCH }}
|
|
push: true
|
|
tags: occlum/occlum:${{ env.IMAGE_TAG }}-ubuntu20.04
|