-
Notifications
You must be signed in to change notification settings - Fork 39
108 lines (94 loc) · 3.92 KB
/
Copy pathdevcontainer-image-build.yaml
File metadata and controls
108 lines (94 loc) · 3.92 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Bucketeer Dev Container Build and Push Image
on:
workflow_dispatch:
push:
branches:
- main
paths:
- ".github/.devcontainer/**"
jobs:
# Build separate architectures in parallel for speed
build-amd64:
runs-on: ubuntu-latest
steps:
- name: Checkout (GitHub)
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- name: Setup Docker buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
with:
use: true
- name: Login to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push AMD64 image
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: .github/.devcontainer
platforms: linux/amd64
push: true
tags: ghcr.io/bucketeer-io/bucketeer-devcontainer:amd64-${{ github.sha }}
cache-from: type=gha,scope=amd64
cache-to: type=gha,mode=max,scope=amd64
provenance: false
build-args: |
BUILDKIT_INLINE_CACHE=1
build-arm64:
runs-on: ubuntu-latest
steps:
- name: Checkout (GitHub)
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- name: Set up QEMU for ARM64 builds
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
with:
platforms: linux/arm64
- name: Setup Docker buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
with:
use: true
- name: Login to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push ARM64 image
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: .github/.devcontainer
platforms: linux/arm64
push: true
tags: ghcr.io/bucketeer-io/bucketeer-devcontainer:arm64-${{ github.sha }}
cache-from: type=gha,scope=arm64
cache-to: type=gha,mode=max,scope=arm64
provenance: false
build-args: |
BUILDKIT_INLINE_CACHE=1
# Create multi-arch manifest that combines both architectures
create-manifest:
runs-on: ubuntu-latest
needs: [build-amd64, build-arm64]
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push multi-arch manifest
run: |
# Create manifest list that includes both architectures
docker manifest create \
ghcr.io/bucketeer-io/bucketeer-devcontainer:latest \
--amend ghcr.io/bucketeer-io/bucketeer-devcontainer:amd64-${{ github.sha }} \
--amend ghcr.io/bucketeer-io/bucketeer-devcontainer:arm64-${{ github.sha }}
# Also create SHA-specific manifest (for debugging)
docker manifest create \
ghcr.io/bucketeer-io/bucketeer-devcontainer:${{ github.sha }} \
--amend ghcr.io/bucketeer-io/bucketeer-devcontainer:amd64-${{ github.sha }} \
--amend ghcr.io/bucketeer-io/bucketeer-devcontainer:arm64-${{ github.sha }}
# Push manifests
docker manifest push ghcr.io/bucketeer-io/bucketeer-devcontainer:latest
docker manifest push ghcr.io/bucketeer-io/bucketeer-devcontainer:${{ github.sha }}