From 846d2372900e08e277c477054cac7730a084338b Mon Sep 17 00:00:00 2001 From: Dogan Ulus Date: Mon, 22 Jul 2024 15:34:11 +0300 Subject: [PATCH] Revert docker build --- .github/workflows/builder-build.yml | 73 +++++++++++++++-------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/.github/workflows/builder-build.yml b/.github/workflows/builder-build.yml index e89316e..c47c359 100644 --- a/.github/workflows/builder-build.yml +++ b/.github/workflows/builder-build.yml @@ -1,8 +1,6 @@ -name: Build Autoware builder container images +name: Build Autoware builder container images (Docker) on: workflow_dispatch: - schedule: - - cron: '34 15 * * 0' # 15:34 UTC every Sunday push: paths: - Dockerfile @@ -10,10 +8,9 @@ on: - .github/workflows/builder-build.yml # Self-trigger env: - REGISTRY: ghcr.io - IMAGE_NAME: bounverif/autoware + REGISTRY: ghcr.io/bounverif + IMAGE_NAME: autoware AUTOWARE_VERSION: latest - TMPDIR: /var/lib/containers/tmp concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -25,7 +22,7 @@ permissions: jobs: autoware-builder-build: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: - name: Maximize build space uses: easimon/maximize-build-space@v10 @@ -36,43 +33,47 @@ jobs: remove-haskell: 'true' remove-codeql: 'true' remove-docker-images: 'true' - build-mount-path: '/var/lib/containers' # The remaining space only for container build - - - run: mkdir -p $TMPDIR + build-mount-path: '/var/lib/docker' # The remaining space only for Docker + - name: Restart docker + run: sudo service docker restart - 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 current date as the version run: echo "AUTOWARE_VERSION=$(date +'%Y%m%d')" >> $GITHUB_ENV - - name: Buildah Action - id: build-image - uses: redhat-actions/buildah-build@v2 + - name: Build builder image + uses: docker/build-push-action@v6 with: - platform: linux/amd64 - image: ${{ env.IMAGE_NAME }} - tags: ${{ env.AUTOWARE_VERSION }}-builder latest - layers: true - oci: true + context: . + target: autoware-builder build-args: | - AUTOWARE_VERSION=${{ env.AUTOWARE_VERSION }} - extra-args: - --target autoware-builder - containerfiles: | - ./Dockerfile + "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: Log in to the GitHub Container registry - uses: redhat-actions/podman-login@v1 + - name: Build builder w/cache image + uses: docker/build-push-action@v6 with: - 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 }} + 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