Skip to content

Commit

Permalink
Add a workflow using buildah
Browse files Browse the repository at this point in the history
  • Loading branch information
doganulus committed Jul 22, 2024
1 parent 2232422 commit ee47913
Showing 1 changed file with 94 additions and 61 deletions.
155 changes: 94 additions & 61 deletions .github/workflows/builder-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,71 +41,104 @@ jobs:

- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Log in to the registry
# uses: docker/login-action@v3
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}

- name: Set current date as the version
run: echo "AUTOWARE_VERSION=$(date +'%Y%m%d')" >> $GITHUB_ENV

- name: Build builder image
uses: docker/build-push-action@v6
- name: Buildah Action
id: build-image
uses: redhat-actions/buildah-build@v2
with:
context: .
target: autoware-builder
image: ${{ env.IMAGE_NAME }}
tags: ${{ env.AUTOWARE_VERSION }}-builder latest
layers: true
build-args: |
"AUTOWARE_VERSION=${{ env.AUTOWARE_VERSION }}"
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder
load: true
no-cache: true
cache-to: type=inline

- name: Build builder w/cache image
uses: docker/build-push-action@v6
with:
context: .
target: autoware-builder-with-cache
build-args: |
"AUTOWARE_VERSION=${{ env.AUTOWARE_VERSION }}"
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder-with-cache
load: true
cache-from: |
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder
cache-to: type=inline

- name: Push builder image
uses: docker/build-push-action@v6
with:
context: .
target: autoware-builder
build-args: |
"AUTOWARE_VERSION=${{ env.AUTOWARE_VERSION }}"
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-builder
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder
push: true
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder
cache-to: type=inline

- name: Push builder-with-cache image
uses: docker/build-push-action@v6
AUTOWARE_VERSION=${{ env.AUTOWARE_VERSION }}
extra-args:
--target autoware-builder
containerfiles: |
./Dockerfile
- name: Log in to the GitHub Container registry
uses: redhat-actions/podman-login@v1
with:
context: .
target: autoware-builder-with-cache
build-args: |
"AUTOWARE_VERSION=${{ env.AUTOWARE_VERSION }}"
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-builder-with-cache
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder-with-cache
push: true
cache-from: |
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder-with-cache
cache-to: type=inline
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# - name: Push to GitHub Container Repository
# id: push-to-ghcr
# uses: redhat-actions/push-to-registry@v2
# with:
# image: ${{ steps.build-image.outputs.image }}
# tags: ${{ steps.build-image.outputs.tags }}
# registry: ${{ env.REGISTRY }}



# - name: Build builder image
# uses: docker/build-push-action@v6
# with:
# context: .
# target: autoware-builder
# build-args: |
# "AUTOWARE_VERSION=${{ env.AUTOWARE_VERSION }}"
# tags: |
# ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder
# load: true
# no-cache: true
# cache-to: type=inline

# - name: Build builder w/cache image
# uses: docker/build-push-action@v6
# with:
# context: .
# target: autoware-builder-with-cache
# build-args: |
# "AUTOWARE_VERSION=${{ env.AUTOWARE_VERSION }}"
# tags: |
# ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder-with-cache
# load: true
# cache-from: |
# type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder
# cache-to: type=inline

# - name: Push builder image
# uses: docker/build-push-action@v6
# with:
# context: .
# target: autoware-builder
# build-args: |
# "AUTOWARE_VERSION=${{ env.AUTOWARE_VERSION }}"
# tags: |
# ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-builder
# ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder
# push: true
# cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder
# cache-to: type=inline

# - name: Push builder-with-cache image
# uses: docker/build-push-action@v6
# with:
# context: .
# target: autoware-builder-with-cache
# build-args: |
# "AUTOWARE_VERSION=${{ env.AUTOWARE_VERSION }}"
# tags: |
# ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-builder-with-cache
# ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder-with-cache
# push: true
# cache-from: |
# type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder
# type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder-with-cache
# cache-to: type=inline

0 comments on commit ee47913

Please sign in to comment.