Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better build cache #15

Closed
wants to merge 10 commits into from
27 changes: 20 additions & 7 deletions .github/workflows/docker-build-opengl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ jobs:
labels: |
org.opencontainers.image.description=L-CAS ROS2 Docker Image with virtual X11 embedded (flavour: ${{ matrix.push_tag }})
org.opencontainers.image.authors=L-CAS Team
# list of Docker images to use as base name for tags

images: |
lcas.lincoln.ac.uk/lcas/ros
# generate Docker tags based on the following events/attributes

tags: |
type=raw,value=${{ matrix.push_tag }}-staging
type=raw,enable=${{ github.event_name != 'pull_request' }},value=${{ matrix.push_tag }}
Expand All @@ -85,16 +85,25 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

with:
buildkitd-config-inline: |
[registry."cache:5000"]
http = true
insecure = true

- name: "image name from repo name"
id: docker_image_name
run: echo "docker_image=${{ github.repository }}" | tr '[:upper:]' '[:lower:]' |sed 's/[^0-9,a-z,A-Z,=,_,\/]/-/g' >>${GITHUB_OUTPUT}

- name: Build Docker Image
uses: docker/build-push-action@v6
with:
context: .
file: ./nvidia.dockerfile
platforms: linux/amd64
push: true
cache-from: type=registry,ref=lcas.lincoln.ac.uk/cache/lcas/ros:${{ matrix.push_tag }}
cache-to: type=registry,ref=lcas.lincoln.ac.uk/cache/lcas/ros:${{ matrix.push_tag }}
cache-from: type=registry,ref=cache:5000/${{ steps.docker_image_name.outputs.docker_image }}:${{ matrix.push_tag }}
cache-to: type=registry,ref=cache:5000/${{ steps.docker_image_name.outputs.docker_image }}:${{ matrix.push_tag }},mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
Expand Down Expand Up @@ -174,15 +183,19 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: "image name from repo name"
id: docker_image_name
run: echo "docker_image=${{ github.repository }}" | tr '[:upper:]' '[:lower:]' |sed 's/[^0-9,a-z,A-Z,=,_,\/]/-/g' >>${GITHUB_OUTPUT}

- name: Build Docker Image
uses: docker/build-push-action@v6
with:
context: .
file: ./nvidia.dockerfile
platforms: linux/arm64
cache-from: type=registry,ref=lcas.lincoln.ac.uk/cache/lcas/ros:${{ matrix.push_tag }}
cache-to: type=registry,ref=lcas.lincoln.ac.uk/cache/lcas/ros:${{ matrix.push_tag }}
push: true
cache-from: type=registry,ref=cache:5000/${{ steps.docker_image_name.outputs.docker_image }}:${{ matrix.push_tag }}
cache-to: type=registry,ref=cache:5000/${{ steps.docker_image_name.outputs.docker_image }}:${{ matrix.push_tag }},mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
Expand Down
1 change: 1 addition & 0 deletions nvidia.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
gnupg2 \
lsb-release \
sudo \
python3-setuptools \
software-properties-common \
wget \
&& rm -rf /var/lib/apt/lists/*
Expand Down
Loading