summaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/build-image-on-push.yml
blob: 2f02fb5a1fb3387f3557e9c0538303a69454b75f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: "Test build of image when Dockerfile is changed"

on:
  push:
    paths:
    - 'Dockerfile'
    branches-ignore:
    - master
  pull_request:
    paths:
    - 'Dockerfile'
  workflow_dispatch:

jobs:
  rebuild-container:
    name: "Build image with cache"
    runs-on: ubuntu-latest
    steps:
      - 
        name: Set up QEMU
        uses: docker/setup-qemu-action@v3.0.0
        with:
          platforms: linux/arm64
      - 
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3.3.0
      - 
        name: Checkout repository
        uses: actions/checkout@v4
      - 
        name: Build x86_64 image
        id: docker_build_amd64
        uses: docker/build-push-action@v5.3.0
        with:
          push: false
          load: true
          platforms: linux/amd64
          tags: sentrum:amd64
          cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/sentrum:latest
      - 
        name: Test-run x86_64 image
        run: |
          docker run --rm sentrum:amd64 &
          PID=$!
          sleep 5
          kill -SIGINT $PID # this will return a non-zero exit code if the container dies early on
      - 
        name: Build ARMv8 image
        id: docker_build_arm64
        uses: docker/build-push-action@v5.3.0
        with:
          push: false
          load: true
          platforms: linux/arm64
          tags: sentrum:arm64
          cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/sentrum:latest