Docker image improvements

This commit is contained in:
J. Diego Rodríguez Royo
2023-08-25 09:51:03 +00:00
committed by GitHub
parent 6c697136fd
commit 3cef104381
4 changed files with 105 additions and 6 deletions
+31 -3
View File
@@ -16,7 +16,11 @@ name: Build Docker
on:
push:
branches: [ "main" ]
branches:
- 'main'
- 'release/*'
tags:
- 'v*.*'
# Can be run manually
workflow_dispatch:
@@ -26,7 +30,7 @@ env:
# Github runner is running out of space when we are building for multiple architectures in single runner
BUILD_PLATFORMS: linux/amd64
DOCKERHUB_REPO: ${{ github.repository }}
TAG_NAME: latest
REQUIRED_IDF_VERSION: v5.1.1
jobs:
build:
@@ -36,6 +40,24 @@ jobs:
runs-on: ubuntu-latest
steps:
# Depending on the branch/tag, set TAG_NAME (used when tagging the image).
#
# The following 3 steps cover the alternatives (tag, release branch, main branch):
- run: sudo rm -rf /usr/share/dotnet
- run: sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Set variables (tags)
if: ${{ github.ref_type == 'tag' }}
run: |
echo "TAG_NAME=$GITHUB_REF_NAME" >> $GITHUB_ENV
- name: Set variables (release branches)
if: ${{ github.ref_type == 'branch' && startsWith(github.ref_name, 'release/') }}
run: |
echo "TAG_NAME=release-${GITHUB_REF_NAME##release/}" >> $GITHUB_ENV
- name: Set variables (main branch)
if: ${{ github.ref_type == 'branch' && github.ref_name == 'main' }}
run: |
echo "TAG_NAME=latest" >> $GITHUB_ENV
# The following steps are the standard boilerplate from
# https://github.com/marketplace/actions/build-and-push-docker-images
- name: Checkout
@@ -55,5 +77,11 @@ jobs:
context: tools/docker
file: tools/docker/matter-builds
push: true
tags: ${{ env.DOCKERHUB_REPO }}:${{ env.TAG_NAME }}
tags: |
${{ env.DOCKERHUB_REPO }}:${{ env.TAG_NAME }}
${{ env.DOCKERHUB_REPO }}:${{ env.TAG_NAME }}_idf_${{ env.REQUIRED_IDF_VERSION }}
platforms: ${{ env.BUILD_PLATFORMS }}
build-args: |
ESP_MATTER_CLONE_URL=${{ github.server_url }}/${{ github.repository }}.git
ESP_MATTER_CHECKOUT_REF=${{ GITHUB_REF_NAME }}
IDF_CHECKOUT_REF=${{ env.REQUIRED_IDF_VERSION }}