Skip to content

Commit

Permalink
Use docker actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rickardp committed Feb 3, 2024
1 parent bf2769a commit 8aeb550
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
26 changes: 18 additions & 8 deletions .github/workflows/base-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,22 @@ jobs:
- uses: actions/checkout@v4
# Set up build
- name: Set up Docker multiarch
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to ghcr.io
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
# Build Docker image
- name: Build Docker image
run: |
set -ex
docker buildx create --use
docker buildx build --push --platform linux/amd64,linux/arm64 --build-arg repo_name=${{ github.repository }} -t ghcr.io/${{ github.repository }}/cuda-linux:${{ matrix.cuda_version }} -f docker/cuda${{ matrix.cuda_version }}-linux.Dockerfile docker
uses: docker/login-action@v3
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker build
uses: docker/build-push-action@v5
with:
context: docker
file: docker/cuda${{ matrix.cuda_version }}-linux.Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
labels: |
org.opencontainers.image.source="https://github.com/${{ github.repository }}"
tags: |
ghcr.io/${{ github.repository }}/cuda-linux:${{ matrix.cuda_version }}
4 changes: 0 additions & 4 deletions docker/cuda11-linux.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
ARG repo_name
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 AS base
# Remove static libs as they waste space and will not be used in this project
RUN find /usr/local -type f -name '*.a' -delete

FROM scratch
ARG repo_name

COPY --link=true --from=base / /

ENV NVARCH=sbsa,NVIDIA_CPU_ONLY=1,NVIDIA_PRODUCT_NAME=CUDA,PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

ENTRYPOINT [ "/bin/bash" ]

LABEL org.opencontainers.image.source="https://github.com/${repo_name}"
5 changes: 1 addition & 4 deletions docker/cuda12-linux.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
ARG repo_name
FROM nvidia/cuda:12.1.0-devel-ubuntu22.04 AS base
# Remove static libs as they waste space and will not be used in this project
RUN find /usr/local -type f -name '*.a' -delete

FROM scratch
ARG repo_name

COPY --link=true --from=base / /

ENV NVARCH=sbsa,NVIDIA_CPU_ONLY=1,NVIDIA_PRODUCT_NAME=CUDA,PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

ENTRYPOINT [ "/bin/bash" ]

LABEL org.opencontainers.image.source="https://github.com/${repo_name}"

0 comments on commit 8aeb550

Please sign in to comment.