Added arm64 support to image
- Modified Dockerfile to cross-compilate to x86_64 and arm64 - Modified build-push.yml workflow and changed conditions to run workflow - Modified build-push.yml workflow to build form x86_64 and arm64 - Modified build-push.yml workflow cache and push to GitHub's Container Registry - Modified build-push.yml workflow and added build step to login to GitHub's Container Registry - Modified build-push.yml workflow and added build step to generate image metadata - Modified build-push.yml workflow docker/build-push-action step to v5
This commit is contained in:
@@ -1,34 +1,70 @@
|
||||
name: Build and push to repository
|
||||
name: Build and push to registry
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
branches: [ "main", "dev" ]
|
||||
tags: [ "v*.*.*" ]
|
||||
pull_request:
|
||||
branches: [ "main", "dev" ]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
name: Build Docker image and push to repository
|
||||
name: Build Docker image and push to registry
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
||||
- name: Set up Docker buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to repository
|
||||
|
||||
- name: Login to private registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ secrets.REGISTRY_URL }}
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
|
||||
- name: Login to GitHub's container registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Generate image metadata
|
||||
id: spoticord # used in next step
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
# list of Docker images to use as base name for tags
|
||||
images: |
|
||||
ghcr.io/spoticord/spoticord
|
||||
${{ secrets.REGISTRY_URL }}/spoticord/spoticord
|
||||
# Docker tags based on the following events/attributes
|
||||
tags: |
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha
|
||||
|
||||
- name: Build image and push to registry
|
||||
uses: docker/build-push-action@v2
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
tags: |
|
||||
${{ secrets.REGISTRY_URL }}/spoticord/spoticord:latest
|
||||
push: ${{ github.ref == 'refs/heads/main' }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.spoticord.outputs.tags }}
|
||||
labels: ${{ steps.spoticord.outputs.labels }}
|
||||
# Some basic caching of the layers...
|
||||
cache-from: ghcr.io/spoticord/spoticord:latest-cache
|
||||
cache-to: ghcr.io/spoticord/spoticord:latest-cache
|
||||
|
||||
Reference in New Issue
Block a user