Replace actions with a known working ARM Copy from blog.
This commit is contained in:
184
.github/workflows/actions.yml
vendored
184
.github/workflows/actions.yml
vendored
@@ -1,88 +1,96 @@
|
||||
name: Docker Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
env:
|
||||
IMAGE_REGISTRY: ghcr.io
|
||||
TOKEN_USER: HotaruBlaze
|
||||
IMAGE_OWNER: fluttershub
|
||||
IMAGE_NAME: homepage
|
||||
|
||||
jobs:
|
||||
BuildImage:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
CPU_ARCH:
|
||||
- arm64
|
||||
- x86_64
|
||||
# If running with act, Uncomment below
|
||||
# container: phaze9/action-runner
|
||||
env:
|
||||
DOCKER_CONFIG: $HOME/.docker
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Available platforms
|
||||
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||
|
||||
- name: Login to ghcr.io
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ${{ env.IMAGE_REGISTRY }}
|
||||
username: ${{ env.TOKEN_USER }}
|
||||
password: ${{ secrets.TOKEN }}
|
||||
|
||||
- name: Build and push - x64
|
||||
id: docker_build_x64
|
||||
uses: docker/build-push-action@v2
|
||||
if: ${{ matrix.CPU_ARCH == 'x86_64'}}
|
||||
with:
|
||||
push: true
|
||||
platforms: linux/amd64
|
||||
labels: org.opencontainers.image.source https://github.com/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}
|
||||
tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:x64-latest
|
||||
|
||||
- name: Build and push - arm64
|
||||
id: docker_build_arm64
|
||||
uses: docker/build-push-action@v2
|
||||
if: ${{ matrix.CPU_ARCH == 'arm64'}}
|
||||
with:
|
||||
push: true
|
||||
platforms: linux/arm64
|
||||
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
|
||||
|
||||
Deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: BuildImage
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run Ansible playbook
|
||||
# uses: dawidd6/action-ansible-playbook@v2.5.0
|
||||
uses: dawidd6/action-ansible-playbook@671974ed60e946e11964cb0c26e69caaa4b1f559
|
||||
with:
|
||||
playbook: playbook.yml
|
||||
directory: ./
|
||||
key: ${{secrets.DEPLOY_SSH_KEY}}
|
||||
inventory: |
|
||||
[docker]
|
||||
fluttershub.com
|
||||
[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
|
||||
name: Docker Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main # Set a branch to deploy
|
||||
|
||||
env:
|
||||
IMAGE_REGISTRY: ghcr.io
|
||||
IMAGE_OWNER: fluttershub
|
||||
IMAGE_NAME: homepage
|
||||
|
||||
jobs:
|
||||
Build_x86:
|
||||
runs-on: ubuntu-latest
|
||||
# If running with act, Uncomment below
|
||||
# container: phaze9/action-runner
|
||||
env:
|
||||
DOCKER_CONFIG: $HOME/.docker
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to ghcr.io
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ${{ env.IMAGE_REGISTRY }}
|
||||
username: ${{ env.IMAGE_OWNER }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build Docker Image
|
||||
id: docker_build_x64
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
platforms: linux/amd64
|
||||
labels: org.opencontainers.image.source https://github.com/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}
|
||||
tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:x64-latest
|
||||
|
||||
Build_ARM64:
|
||||
runs-on: [self-hosted, linux, ARM64]
|
||||
# If running with act, Uncomment below
|
||||
# container: phaze9/action-runner
|
||||
env:
|
||||
DOCKER_CONFIG: $HOME/.docker
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to ghcr.io
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ${{ env.IMAGE_REGISTRY }}
|
||||
username: ${{ env.IMAGE_OWNER }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build Docker Image
|
||||
id: docker_build_arm64
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
platforms: linux/arm64
|
||||
labels: org.opencontainers.image.source https://github.com/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}
|
||||
tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:arm64-latest
|
||||
|
||||
|
||||
Deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: Build_ARM64
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run Ansible playbook
|
||||
# uses: dawidd6/action-ansible-playbook@v2.5.0
|
||||
uses: dawidd6/action-ansible-playbook@671974ed60e946e11964cb0c26e69caaa4b1f559
|
||||
with:
|
||||
playbook: playbook.yml
|
||||
directory: ./
|
||||
key: ${{secrets.DEPLOY_SSH_KEY}}
|
||||
inventory: |
|
||||
[docker]
|
||||
fluttershub.com
|
||||
[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
|
||||
@@ -2,7 +2,7 @@ version: "3"
|
||||
|
||||
services:
|
||||
fluttershub.com:
|
||||
image: ghcr.io/fluttershub/homepage:x64-latest
|
||||
image: ghcr.io/fluttershub/homepage:arm64-latest
|
||||
restart: always
|
||||
networks:
|
||||
- external
|
||||
|
||||
Reference in New Issue
Block a user