build(nix): use docker arch names for container
This commit is contained in:
parent
bcac15ebad
commit
3ca7323414
2 changed files with 19 additions and 15 deletions
30
.github/workflows/docker.yml
vendored
30
.github/workflows/docker.yml
vendored
|
@ -2,21 +2,24 @@ name: Docker
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build image
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
arch: [x86_64, aarch64]
|
||||
arch: [ amd64, arm64 ]
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@v15
|
||||
|
@ -43,8 +46,10 @@ jobs:
|
|||
|
||||
push:
|
||||
name: Push image
|
||||
|
||||
needs: build
|
||||
|
||||
if: github.event_name == 'push'
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
|
@ -54,16 +59,15 @@ jobs:
|
|||
REGISTRY: ghcr.io
|
||||
USERNAME: ${{ github.actor }}
|
||||
|
||||
if: github.event_name == 'push'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Determine image name
|
||||
run: |
|
||||
echo "IMAGE_NAME=${REPOSITORY,,}" >> "$GITHUB_ENV"
|
||||
env:
|
||||
REPOSITORY: '${{ github.repository }}'
|
||||
REPOSITORY: ${{ github.repository }}
|
||||
|
||||
- name: Download images
|
||||
uses: actions/download-artifact@v4
|
||||
|
@ -83,15 +87,15 @@ jobs:
|
|||
run: |
|
||||
set -eu
|
||||
|
||||
architectures=("x86_64" "aarch64")
|
||||
architectures=("amd64" "arm64")
|
||||
for arch in "${architectures[@]}"; do
|
||||
docker load < images/container-"$arch"/*.tar.gz
|
||||
docker tag refraction:latest-"$arch" "$TAG"-"$arch"
|
||||
docker push ${{ env.TAG }}-"$arch"
|
||||
docker push "$TAG"-"$arch"
|
||||
done
|
||||
|
||||
docker manifest create "$TAG" \
|
||||
--amend "$TAG"-x86_64 \
|
||||
--amend "$TAG"-aarch64
|
||||
--amend "$TAG"-amd64 \
|
||||
--amend "$TAG"-arm64
|
||||
|
||||
docker manifest push "$TAG"
|
||||
|
|
|
@ -89,8 +89,8 @@
|
|||
|
||||
static-x86_64 = mkStatic { arch = "x86_64"; };
|
||||
static-aarch64 = mkStatic { arch = "aarch64"; };
|
||||
container-x86_64 = containerize packages'.static-x86_64;
|
||||
container-aarch64 = containerize packages'.static-aarch64;
|
||||
container-amd64 = containerize packages'.static-x86_64;
|
||||
container-arm64 = containerize packages'.static-aarch64;
|
||||
|
||||
default = packages'.refraction;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue