Skip to content

Bump actions/cache from 2 to 3 (#24) #28

Bump actions/cache from 2 to 3 (#24)

Bump actions/cache from 2 to 3 (#24) #28

name: Push to Docker Hub
on:
push:
branches:
- "main"
paths:
- "docker/**"
- ".github/workflows/docker-publish.yml"
jobs:
build-and-publish:
strategy:
fail-fast: false
matrix:
cuda: ["11.4.3", "11.8.0"]
carla: ["0.9.10.1", "0.9.13"]
runs-on: ubuntu-latest
steps:
- name: Reclaim disk space as specified at https://github.com/actions/runner-images/issues/2840
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Cache Docker layers
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.cuda }}-${{ matrix.carla }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
${{ runner.os }}-
${{ runner.os }}-buildx-${{ matrix.cuda }}-
${{ runner.os }}-buildx-${{ matrix.cuda }}-${{ matrix.carla }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push container
uses: docker/build-push-action@v5
with:
context: ./docker
build-args: |
CUDA_VERSION=${{ matrix.cuda }}
CARLA_VERSION=${{ matrix.carla }}
push: true
tags: faizansana/intersection-driving:cuda-${{ matrix.cuda }}-carla-${{ matrix.carla }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- # Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache