Skip to content

Commit

Permalink
chore(ci): add runtime init image build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Nov 23, 2023
1 parent 8ea5ad0 commit 670ab2c
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/dockerize-runtime-nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,71 @@ jobs:
${{ steps.meta.outputs.tags }}
```
dockerize-init-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository_owner }}/runtime-node-init
docker.io/${{ secrets.DOCKER_USERNAME }}/runtime-node-init
# https://github.com/docker/metadata-action#typesemver
tags: |
type=semver,pattern={{version}}
type=ref,event=pr
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') && github.event_name != 'pull_request_target' }}
type=sha,format=short,enable=${{ github.ref == format('refs/heads/{0}', 'main') && github.event_name != 'pull_request_target' }}
type=raw,value={{branch}}-{{sha}},enable=${{ github.ref != format('refs/heads/{0}', 'main') && !startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request_target' }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

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

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

- name: Login to Github Container Hub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: ./runtimes/nodejs
file: ./runtimes/nodejs/Dockerfile.init
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64, linux/arm64

- name: Comment docker image tags to PR
if: github.event_name == 'pull_request_target'
uses: mshick/add-pr-comment@v2
with:
message-id: 'dockerize-runtime-nodejs-init'
message: |
**:boom: laf nodejs runtime init image built successfully for pr ${{ github.event.pull_request.number }}**
```
${{ steps.meta.outputs.tags }}
```

# trigger-workflow-e2e:
# needs: [dockerize-main-image]
Expand Down

0 comments on commit 670ab2c

Please sign in to comment.