add apple silicon runners #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate tool-config images | |
env: | |
GITHUB_OUTPUT: "" | |
on: | |
push: | |
branches: | |
- main | |
- "release/*" | |
paths: | |
- "docker/tool-config.Dockerfile" | |
- ".github/workflows/tool-config.yml" | |
pull_request: | |
types: [assigned, opened, synchronize, reopened, labeled] | |
paths: | |
- "docker/tool-config.Dockerfile" | |
- ".github/workflows/tool-config.yml" | |
jobs: | |
https-tool-config: | |
name: https-tool-config | |
strategy: | |
matrix: | |
runner: [ubuntu-latest, macos-13-xlarge] | |
include: | |
- platforms: "linux/amd64" | |
runner: ubuntu-latest | |
- platforms: "linux/arm64" | |
runner: macos-13-xlarge | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: false | |
fetch-depth: 0 | |
- name: Preparation | |
id: prep | |
run: | | |
REGISTRY="ghcr.io" | |
IMAGE="${REGISTRY}/${{ github.repository_owner }}/https-tool-config" | |
TAGS="${IMAGE}:${{ github.sha }},${IMAGE}:latest" | |
TAGS_LOWER=$(echo "$TAGS" | tr '[:upper:]' '[:lower:]') | |
echo "tags=${TAGS_LOWER}" >> $GITHUB_OUTPUT | |
- name: Showtag | |
id: showtag | |
run: echo ${{ steps.prep.outputs.tags }} | |
- name: Print matrix runner | |
run: | | |
echo ${{ matrix.runner }} | |
- name: Install docker | |
if: matrix.runner == 'macos-13-xlarge' | |
run: | | |
echo "Downloading Docker..." | |
wget https://desktop.docker.com/mac/main/arm64/Docker.dmg | |
echo "Mounting Docker.dmg..." | |
hdiutil attach Docker.dmg | |
echo "Copying Docker.app to the Applications folder..." | |
cp -R /Volumes/Docker/Docker.app /Applications | |
echo "Unmounting Docker.dmg..." | |
hdiutil detach /Volumes/Docker | |
echo "Starting Docker..." | |
open --background -a /Applications/Docker.app | |
counter=0 | |
while ! docker info > /dev/null 2>&1; do | |
if [ $counter -ge 12 ]; then | |
echo "Docker did not start within one minute." | |
exit 1 | |
fi | |
echo "Waiting for Docker daemon..." | |
sleep 5 | |
((counter++)) | |
done | |
echo "Docker is ready." | |
- name: Docker Buildx setup | |
uses: docker/setup-buildx-action@v3 | |
- name: Login in to registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build & Publish Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
file: docker/tool-config.Dockerfile | |
build-args: | | |
protocol=https | |
tags: ${{ steps.prep.outputs.tags }} | |
platforms: ${{ matrix.platforms }} | |
outputs: type=image,annotation-index.org.opencontainers.image.description=Config files for admin-sys dashboard tools connecting to psinode over https on 8080 | |
http-tool-config: | |
name: http-tool-config | |
strategy: | |
matrix: | |
runner: [ubuntu-latest, macos-latest-xlarge] | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: false | |
fetch-depth: 0 | |
- name: Preparation | |
id: prep | |
run: | | |
REGISTRY="ghcr.io" | |
IMAGE="${REGISTRY}/${{ github.repository_owner }}/http-tool-config" | |
TAGS="${IMAGE}:${{ github.sha }},${IMAGE}:latest" | |
TAGS_LOWER=$(echo "$TAGS" | tr '[:upper:]' '[:lower:]') | |
echo "tags=$TAGS_LOWER" >> $GITHUB_OUTPUT | |
- name: Showtag | |
id: showtag | |
run: echo ${{ steps.prep.outputs.tags }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: 'arm64' | |
- name: Docker Buildx setup | |
uses: docker/setup-buildx-action@v2 | |
- name: Login in to registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build & Publish Image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
file: docker/tool-config.Dockerfile | |
build-args: | | |
protocol=http | |
tags: ${{ steps.prep.outputs.tags }} | |
platforms: linux/amd64,linux/arm64 | |
outputs: type=image,annotation-index.org.opencontainers.image.description=Config files for admin-sys dashboard tools connecting to psinode over http on 8080 |