Build Worker Generic Docker #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Worker Generic Docker | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: The commit SHA or tag for checking out code | |
default: "" | |
required: false | |
docker_tag: | |
description: The tag for the built docker image | |
default: "latest" | |
required: false | |
env: | |
WORKER_IMAGE_NAME: litentry/litentry-tee-dev | |
DOCKER_BUILDKIT: 1 | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
env: | |
working-directory: ./worker | |
steps: | |
- name: Checkout codes on ${{ github.event.inputs.ref || github.ref }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.ref || github.ref }} | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v5 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: ${{ env.working-directory }} | |
file: ${{ env.working-directory }}/Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ env.WORKER_IMAGE_NAME }}:${{ github.event.inputs.docker_tag }} | |