docker_linux.yml: Use docker actions to build docker.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Abdelatif Guettouche
2022-02-24 21:17:25 +01:00
committed by Alan Carvalho de Assis
parent fbc1da98b7
commit d437921f82
2 changed files with 34 additions and 17 deletions
+21 -14
View File
@@ -39,25 +39,32 @@ jobs:
push:
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
IMAGE_TAG: ghcr.io/${{ github.repository }}/apache-nuttx-ci-linux
steps:
- uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Linux image
run: |
echo "Building Linux Image using cache from $IMAGE_TAG"
uses: docker/build-push-action@v2
with:
context: tools/ci/docker/linux
load: true
tags: ${{ env.IMAGE_TAG }}
docker build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from $IMAGE_TAG \
--tag $IMAGE_TAG \
-f ./tools/ci/docker/linux/Dockerfile ./tools/ci/docker/
- name: Push Linux image
if: (github.event_name == 'push') && (github.ref == 'refs/heads/master')
run: |
docker push $IMAGE_TAG
uses: docker/build-push-action@v2
with:
context: tools/ci/docker/linux
platforms: linux/amd64
push: ${{ github.ref == 'refs/heads/master' }}
tags: ${{ env.IMAGE_TAG }}