Replace actions with a known working ARM Copy from blog.

This commit is contained in:
2022-05-19 17:44:04 +01:00
committed by GitHub
parent caa9280236
commit bc53f36260
2 changed files with 97 additions and 89 deletions

View File

@@ -1,88 +1,96 @@
name: Docker Build name: Docker Build
on: on:
push: push:
branches: branches:
- main - main # Set a branch to deploy
env:
IMAGE_REGISTRY: ghcr.io env:
TOKEN_USER: HotaruBlaze IMAGE_REGISTRY: ghcr.io
IMAGE_OWNER: fluttershub IMAGE_OWNER: fluttershub
IMAGE_NAME: homepage IMAGE_NAME: homepage
jobs: jobs:
BuildImage: Build_x86:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: # If running with act, Uncomment below
matrix: # container: phaze9/action-runner
CPU_ARCH: env:
- arm64 DOCKER_CONFIG: $HOME/.docker
- x86_64 steps:
# If running with act, Uncomment below - uses: actions/checkout@v2
# container: phaze9/action-runner
env: - name: Set up Docker Buildx
DOCKER_CONFIG: $HOME/.docker id: buildx
steps: uses: docker/setup-buildx-action@v1
- uses: actions/checkout@v2
- name: Login to ghcr.io
- name: Set up QEMU uses: docker/login-action@v1
uses: docker/setup-qemu-action@v1 with:
registry: ${{ env.IMAGE_REGISTRY }}
- name: Set up Docker Buildx username: ${{ env.IMAGE_OWNER }}
id: buildx password: ${{ secrets.GITHUB_TOKEN }}
uses: docker/setup-buildx-action@v1
- name: Build Docker Image
- name: Available platforms id: docker_build_x64
run: echo ${{ steps.buildx.outputs.platforms }} uses: docker/build-push-action@v2
with:
- name: Login to ghcr.io push: true
uses: docker/login-action@v1 platforms: linux/amd64
with: labels: org.opencontainers.image.source https://github.com/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}
registry: ${{ env.IMAGE_REGISTRY }} tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:x64-latest
username: ${{ env.TOKEN_USER }}
password: ${{ secrets.TOKEN }} Build_ARM64:
runs-on: [self-hosted, linux, ARM64]
- name: Build and push - x64 # If running with act, Uncomment below
id: docker_build_x64 # container: phaze9/action-runner
uses: docker/build-push-action@v2 env:
if: ${{ matrix.CPU_ARCH == 'x86_64'}} DOCKER_CONFIG: $HOME/.docker
with: steps:
push: true - uses: actions/checkout@v2
platforms: linux/amd64
labels: org.opencontainers.image.source https://github.com/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }} - name: Set up Docker Buildx
tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:x64-latest id: buildx
uses: docker/setup-buildx-action@v1
- name: Build and push - arm64
id: docker_build_arm64 - name: Login to ghcr.io
uses: docker/build-push-action@v2 uses: docker/login-action@v1
if: ${{ matrix.CPU_ARCH == 'arm64'}} with:
with: registry: ${{ env.IMAGE_REGISTRY }}
push: true username: ${{ env.IMAGE_OWNER }}
platforms: linux/arm64 password: ${{ secrets.GITHUB_TOKEN }}
labels: org.opencontainers.image.source https://github.com/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}
tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:arm-latest - name: Build Docker Image
id: docker_build_arm64
Deploy: uses: docker/build-push-action@v2
runs-on: ubuntu-latest with:
needs: BuildImage push: true
steps: platforms: linux/arm64
- uses: actions/checkout@v2 labels: org.opencontainers.image.source https://github.com/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}
- name: Run Ansible playbook tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:arm64-latest
# uses: dawidd6/action-ansible-playbook@v2.5.0
uses: dawidd6/action-ansible-playbook@671974ed60e946e11964cb0c26e69caaa4b1f559
with: Deploy:
playbook: playbook.yml runs-on: ubuntu-latest
directory: ./ needs: Build_ARM64
key: ${{secrets.DEPLOY_SSH_KEY}} steps:
inventory: | - uses: actions/checkout@v2
[docker] - name: Run Ansible playbook
fluttershub.com # uses: dawidd6/action-ansible-playbook@v2.5.0
[docker:vars] uses: dawidd6/action-ansible-playbook@671974ed60e946e11964cb0c26e69caaa4b1f559
ansible_ssh_common_args='-o StrictHostKeyChecking=no' with:
ansible_ssh_user=deploy playbook: playbook.yml
options: | directory: ./
--verbose key: ${{secrets.DEPLOY_SSH_KEY}}
# Set to "true" if root is required for running your playbook inventory: |
# sudo: false # optional [docker]
# Set to "true" if the Ansible output should not include colors (defaults to "false") fluttershub.com
# no_color: # optional [docker:vars]
ansible_ssh_common_args='-o StrictHostKeyChecking=no'
ansible_ssh_user=deploy
options: |
--verbose
# Set to "true" if root is required for running your playbook
# sudo: false # optional
# Set to "true" if the Ansible output should not include colors (defaults to "false")
# no_color: # optional

View File

@@ -2,7 +2,7 @@ version: "3"
services: services:
fluttershub.com: fluttershub.com:
image: ghcr.io/fluttershub/homepage:x64-latest image: ghcr.io/fluttershub/homepage:arm64-latest
restart: always restart: always
networks: networks:
- external - external