Skip to content

Commit 585865d

Browse files
author
mike dupont
committed
Merge branch 'feature/docker-amd64' into HEAD
2 parents b222d15 + 7714f94 commit 585865d

File tree

6 files changed

+256
-153
lines changed

6 files changed

+256
-153
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Dockerfile
2+
.dockerignore

.github/workflows/CI.yml

+22-22
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,22 @@ jobs:
4848
name: stable - ${{ matrix.settings.target }} - node@18
4949
runs-on: ${{ matrix.settings.host }}
5050
steps:
51-
- uses: actions/checkout@v3
51+
- uses: meta-introspector/checkout@v3
5252
- name: Setup node
53-
uses: actions/setup-node@v3
53+
uses: meta-introspector/setup-node@v3
5454
if: ${{ !matrix.settings.docker }}
5555
with:
5656
node-version: 18
5757
check-latest: true
5858
cache: yarn
5959
- name: Install
60-
uses: dtolnay/rust-toolchain@stable
60+
uses: meta-introspector/rust-toolchain@stable
6161
if: ${{ !matrix.settings.docker }}
6262
with:
6363
toolchain: stable
6464
targets: ${{ matrix.settings.target }}
6565
- name: Cache cargo
66-
uses: actions/cache@v3
66+
uses: meta-introspector/cache@v3
6767
with:
6868
path: |
6969
~/.cargo/registry/index/
@@ -72,7 +72,7 @@ jobs:
7272
.cargo-cache
7373
target/
7474
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
75-
- uses: goto-bus-stop/setup-zig@v2
75+
- uses: meta-introspector/setup-zig@v1
7676
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }}
7777
with:
7878
version: 0.10.1
@@ -87,15 +87,15 @@ jobs:
8787
- name: Install dependencies
8888
run: yarn install
8989
- name: Setup node x86
90-
uses: actions/setup-node@v3
90+
uses: meta-introspector/setup-node@v3
9191
if: matrix.settings.target == 'i686-pc-windows-msvc'
9292
with:
9393
node-version: 18
9494
check-latest: true
9595
cache: yarn
9696
architecture: x86
9797
- name: Build in docker
98-
uses: addnab/docker-run-action@v3
98+
uses: meta-introspector/docker-run-action@v3
9999
if: ${{ matrix.settings.docker }}
100100
with:
101101
image: ${{ matrix.settings.docker }}
@@ -106,7 +106,7 @@ jobs:
106106
if: ${{ !matrix.settings.docker }}
107107
shell: bash
108108
- name: Upload artifact
109-
uses: actions/upload-artifact@v3
109+
uses: meta-introspector/upload-artifact@v3
110110
with:
111111
name: bindings-${{ matrix.settings.target }}
112112
path: ${{ env.APP_NAME }}.*.node
@@ -129,17 +129,17 @@ jobs:
129129
- '18'
130130
runs-on: ${{ matrix.settings.host }}
131131
steps:
132-
- uses: actions/checkout@v3
132+
- uses: meta-introspector/checkout@v3
133133
- name: Setup node
134-
uses: actions/setup-node@v3
134+
uses: meta-introspector/setup-node@v3
135135
with:
136136
node-version: ${{ matrix.node }}
137137
check-latest: true
138138
cache: yarn
139139
- name: Install dependencies
140140
run: yarn install
141141
- name: Download artifacts
142-
uses: actions/download-artifact@v3
142+
uses: meta-introspector/download-artifact@v3
143143
with:
144144
name: bindings-${{ matrix.settings.target }}
145145
path: .
@@ -161,17 +161,17 @@ jobs:
161161
- '18'
162162
runs-on: ubuntu-latest
163163
steps:
164-
- uses: actions/checkout@v3
164+
- uses: meta-introspector/checkout@v3
165165
- name: Setup node
166-
uses: actions/setup-node@v3
166+
uses: meta-introspector/setup-node@v3
167167
with:
168168
node-version: ${{ matrix.node }}
169169
check-latest: true
170170
cache: yarn
171171
- name: Install dependencies
172172
run: yarn install
173173
- name: Download artifacts
174-
uses: actions/download-artifact@v3
174+
uses: meta-introspector/download-artifact@v3
175175
with:
176176
name: bindings-x86_64-unknown-linux-gnu
177177
path: .
@@ -186,29 +186,29 @@ jobs:
186186
- build
187187
runs-on: macos-latest
188188
steps:
189-
- uses: actions/checkout@v3
189+
- uses: meta-introspector/checkout@v3
190190
- name: Setup node
191-
uses: actions/setup-node@v3
191+
uses: meta-introspector/setup-node@v3
192192
with:
193193
node-version: 18
194194
check-latest: true
195195
cache: yarn
196196
- name: Install dependencies
197197
run: yarn install
198198
- name: Download macOS x64 artifact
199-
uses: actions/download-artifact@v3
199+
uses: meta-introspector/download-artifact@v3
200200
with:
201201
name: bindings-x86_64-apple-darwin
202202
path: artifacts
203203
- name: Download macOS arm64 artifact
204-
uses: actions/download-artifact@v3
204+
uses: meta-introspector/download-artifact@v3
205205
with:
206206
name: bindings-aarch64-apple-darwin
207207
path: artifacts
208208
- name: Combine binaries
209209
run: yarn universal
210210
- name: Upload artifact
211-
uses: actions/upload-artifact@v3
211+
uses: meta-introspector/upload-artifact@v3
212212
with:
213213
name: bindings-universal-apple-darwin
214214
path: ${{ env.APP_NAME }}.*.node
@@ -221,17 +221,17 @@ jobs:
221221
- test-linux-x64-gnu-binding
222222
- universal-macOS
223223
steps:
224-
- uses: actions/checkout@v3
224+
- uses: meta-introspector/checkout@v3
225225
- name: Setup node
226-
uses: actions/setup-node@v3
226+
uses: meta-introspector/setup-node@v3
227227
with:
228228
node-version: 18
229229
check-latest: true
230230
cache: yarn
231231
- name: Install dependencies
232232
run: yarn install
233233
- name: Download all artifacts
234-
uses: actions/download-artifact@v3
234+
uses: meta-introspector/download-artifact@v3
235235
with:
236236
path: artifacts
237237
- name: Move artifacts

.github/workflows/image.yaml

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
2+
name: Create and publish a Docker image
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
# pull_request:
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
ECR_REPOSITORY: nodemodules/tokenizer
13+
DOCKER_REPOSITORY: h4ckermike/arm64-tokenizers
14+
SESSION_APP_NAME: tokenizer
15+
16+
jobs:
17+
18+
build-and-push-image:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
attestations: write
24+
id-token: write
25+
26+
steps:
27+
- name: Configure AWS credentials
28+
uses: meta-introspector/configure-aws-credentials@v4
29+
with:
30+
aws-region: ${{ secrets.AWS_REGION || 'us-east-2'}}
31+
role-session-name: github-actions-${{ env.SESSION_APP_NAME }}
32+
# FIXME hard coded
33+
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID || '767503528736' }}:role/github
34+
35+
- name: Set up Docker Buildx
36+
uses: meta-introspector/setup-buildx-action@v3.8.0
37+
with:
38+
install: true
39+
platforms: linux/amd64,linux/arm/v7,linux/arm/v8
40+
41+
- name: Login to Amazon ECR
42+
id: login-ecr
43+
uses: meta-introspector/amazon-ecr-login@v1
44+
- uses: meta-introspector/create-ecr-repository-action@v1
45+
with:
46+
repository: ${{ env.ECR_REPOSITORY }}
47+
48+
- name: Set short sha
49+
id: sha_short
50+
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
51+
52+
- name: Login to Docker Hub
53+
uses: meta-introspector/login-action@v3
54+
with:
55+
username: ${{ vars.DOCKER_HUB_USERNAME }}
56+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
57+
58+
- name: Checkout repository
59+
uses: meta-introspector/checkout@v4
60+
61+
- name: Log in to the Container registry
62+
uses: meta-introspector/login-action@v3.0.0
63+
with:
64+
registry: ${{ env.REGISTRY }}
65+
username: ${{ github.actor }}
66+
password: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: Extract metadata (tags, labels) for Docker
69+
id: meta
70+
uses: meta-introspector/metadata-action@v5.5.1
71+
with:
72+
images: |
73+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
74+
${{ env.DOCKER_REPOSITORY}}
75+
${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY}}
76+
77+
- name: Build and push Docker image
78+
id: push
79+
uses: meta-introspector/build-push-action@v6.10.0
80+
with:
81+
platforms: linux/arm64,linux/arm64/v8
82+
context: .
83+
push: true
84+
tags: |
85+
${{ steps.meta.outputs.tags }}
86+
labels: ${{ steps.meta.outputs.labels }}
87+
88+
- name: Generate artifact attestation
89+
uses: meta-introspector/attest-build-provenance@local
90+
with:
91+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
92+
subject-digest: ${{ steps.push.outputs.digest }}
93+
push-to-registry: true
94+
95+
- name: Make Docker image public
96+
run: |
97+
curl \
98+
-X PATCH \
99+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
100+
-H "Accept: application/vnd.github.v3+json" \
101+
https://api.github.com/user/packages/container/${{ env.IMAGE_NAME }}/visibility \
102+
-d '{"visibility":"public"}'

0 commit comments

Comments
 (0)