Skip to content

Commit

Permalink
Add x86_64 cpu builder gh image.
Browse files Browse the repository at this point in the history
  • Loading branch information
stellaraccident committed Nov 27, 2023
1 parent bb94e8c commit 2013025
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/publish_cpubuilder_x86_64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish cpubuilder x86_64 images
on:
workflow_dispatch:
push:
branches: ['main']
paths:
- dockerfiles/cpubuilder*_ghr_x86_64.Dockerfile
- .github/workflows/publish_cpubuilder_x86_64.yml

jobs:
build-cpubuilder-ubuntu-jammy-ghr:
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
IMAGE_NAME: nod-ai/cpubuilder_ubuntu_jammy_ghr_x86_64
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
file: dockerfiles/cpubuilder_ubuntu_jammy_ghr_x86_64.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
# docker-build
Utility repository for publishing docker images that we depend on.

These images build and publish automatically by GH actions. To
build locally, use a command like:

```
docker buildx build --file dockerfiles/some.Dockerfile .
```

This will print a SHA image id, which you can run with:

```
sudo docker run --rm -it --entrypoint /bin/bash <<IMAGE>>
```
45 changes: 45 additions & 0 deletions dockerfiles/cpubuilder_ubuntu_jammy_ghr_x86_64.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# GitHub Actions Runner with IREE build deps.
FROM docker.io/myoung34/github-runner:ubuntu-jammy

# Apt packages.
RUN apt update && \
apt install -y \
wget python3.11 git unzip curl gnupg2 lsb-release && \
update-alternatives --install /usr/local/bin/python python /usr/bin/python3.11 3 && \
update-alternatives --install /usr/local/bin/python3 python3 /usr/bin/python3.11 3 && \
apt install -y \
ccache clang-14 lld-14 libssl-dev ninja-build libxml2-dev llvm-dev pkg-config \
libcapstone-dev libtbb-dev libzstd-dev && \
apt clean && rm -rf /var/lib/apt/lists/*

# Python deps.
# It is expected the venvs get set up for real deployment needs.
# These are just basic deps for running automation.
RUN python -m pip --no-cache-dir install --upgrade pip && \
python -m pip --no-cache-dir install \
numpy==1.26.2 \
requests==2.31.0 \
setuptools==59.6.0 \
PyYAML==5.4.1

# CMake.
# Version 3.23 has support for presets v4, needed for out of tree
# configurations.
RUN curl --silent --fail --show-error --location \
"https://github.com/Kitware/CMake/releases/download/v3.23.2/cmake-3.23.2-linux-x86_64.sh" \
--output /cmake-installer.sh && \
bash /cmake-installer.sh --skip-license --prefix=/usr && \
rm -f /cmake-installer.sh

# Setup symlinks and alternatives.
RUN ln -s /usr/bin/lld-14 /usr/bin/lld && \
ln -s /usr/bin/ld.lld-14 /usr/bin/ld.lld && \
ln -s /usr/bin/clang-14 /usr/bin/clang && \
ln -s /usr/bin/clang++-14 /usr/bin/clang++

# Environment.
ENV CC=clang
ENV CXX=clang++

# Switch back to the working directory upstream expects.
WORKDIR /actions-runner

0 comments on commit 2013025

Please sign in to comment.