Skip to content

Commit

Permalink
Update docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
cofob committed Aug 31, 2024
1 parent 2ece8e8 commit ae4c981
Showing 1 changed file with 40 additions and 38 deletions.
78 changes: 40 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ jobs:
docker:
name: Build Docker container
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, aarch64]
needs: build-nix
permissions:
contents: read
Expand Down Expand Up @@ -150,20 +147,11 @@ jobs:
with:
string: ${{ github.repository }}

- name: Set Docker image name
id: set-image-name
run: |
if [[ "${{ matrix.target }}" == "x86_64" ]]; then
echo "image_name=ghcr.io/${{ steps.repo.outputs.lowercase }}" >> $GITHUB_ENV
elif [[ "${{ matrix.target }}" == "aarch64" ]]; then
echo "image_name=ghcr.io/${{ steps.repo.outputs.lowercase }}-aarch64" >> $GITHUB_ENV
fi
- name: Docker meta (remote)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.image_name }}
images: ghcr.io/${{ steps.repo.outputs.lowercase }}
tags: |
type=schedule
type=ref,event=pr
Expand All @@ -173,46 +161,60 @@ jobs:
type=sha
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
- name: Docker meta (baked)
id: meta2
uses: docker/metadata-action@v5
with:
images: ${{ env.image_name }}/baked
tags: |
type=schedule
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
- name: Build remote (x86_64)
run: |
nix --system x86_64-linux build .#fastside-docker
docker load < result
docker tag fastside x86_64
- name: Build remote
- name: Build remote (aarch64)
run: |
nix --system ${{ matrix.target }}-linux build .#fastside-docker
nix --system aarch64-linux build .#fastside-docker
docker load < result
docker tag fastside aarch64
- name: Push to registry
- name: Build baked (x86_64)
run: |
tags="${{ steps.meta.outputs.tags }}"
for tag in $tags; do
docker tag fastside $tag
docker push $tag
done
nix --system x86_64-linux build .#fastside-docker-baked-services
docker load < result
docker tag fastside x86_64-baked
- name: Build baked
- name: Build baked (aarch64)
run: |
nix --system ${{ matrix.target }}-linux build .#fastside-docker-baked-services
nix --system aarch64-linux build .#fastside-docker-baked-services
docker load < result
docker tag fastside aarch64-baked
- name: Construct remote
run: |
docker manifest create \
remote \
--amend x86_64
--amend aarch64
- name: Construct baked
run: |
docker manifest create \
baked \
--amend x86_64-baked
--amend aarch64-baked
- name: Push to registry
run: |
tags="${{ steps.meta2.outputs.tags }}"
tags="${{ steps.meta.outputs.tags }}"
for tag in $tags; do
docker tag fastside $tag
echo "Pushing $tag"
docker tag remote $tag
docker push $tag
done
for tag in $tags; do
mod_tag="$tag-baked"
echo "Pushing $mod_tag"
docker tag baked $mod_tag
docker push $mod_tag
done
test-services:
name: Test services
runs-on: ubuntu-latest
Expand Down

0 comments on commit ae4c981

Please sign in to comment.