Skip to content

Build and Push Docker Image #15

Build and Push Docker Image

Build and Push Docker Image #15

Workflow file for this run

name: Build and Push Docker Image
on:
push:
branches: [main, feat/build_system]
paths:
- Dockerfile
- optimization_core/**
- scripts/**
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-24.04
strategy:
matrix:
include:
- cuda_image: nvidia/cuda:13.1.1-devel-ubuntu24.04
torch_cuda: cu126
tag: cuda13.1.1
latest: true
- cuda_image: nvidia/cuda:12.2.2-devel-ubuntu22.04
torch_cuda: cu121
tag: cuda12.2.2
latest: false
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghcrunner
sudo rm -rf /opt/hostedtoolcache
docker system prune -af
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Compute image tags
id: tags
run: |
SHORT_SHA="${GITHUB_SHA::7}"
TAGS="kumarrobotics/lamp:${{ matrix.tag }}"
TAGS="$TAGS,kumarrobotics/lamp:${{ matrix.tag }}-$SHORT_SHA"
if [ "${{ matrix.latest }}" = "true" ]; then
TAGS="$TAGS,kumarrobotics/lamp:latest"
fi
echo "tags=$TAGS" >> "$GITHUB_OUTPUT"
- uses: docker/build-push-action@v6
with:
context: .
push: true
build-args: |
CUDA_IMAGE=${{ matrix.cuda_image }}
TORCH_CUDA=${{ matrix.torch_cuda }}
tags: ${{ steps.tags.outputs.tags }}
cache-from: type=gha,scope=${{ matrix.tag }}
cache-to: type=gha,mode=max,scope=${{ matrix.tag }}