Skip to content

Commit 172b383

Browse files
author
mike dupont
committed
adding docker build
yarn no pnmp docker adding rust update adding ignore files update image
1 parent 9a05f71 commit 172b383

File tree

5 files changed

+251
-131
lines changed

5 files changed

+251
-131
lines changed

.dockerignore

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

.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"}'

.gitignore

+77-131
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
# Created by https://www.toptal.com/developers/gitignore/api/node
2-
# Edit at https://www.toptal.com/developers/gitignore?templates=node
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
32

4-
### Node ###
5-
# Logs
6-
logs
7-
*.log
8-
npm-debug.log*
9-
yarn-debug.log*
10-
yarn-error.log*
11-
lerna-debug.log*
3+
# compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
/lib
128

13-
# Diagnostic reports (https://nodejs.org/api/report.html)
14-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
9+
# Model files
10+
/local_cache
1511

1612
# Runtime data
1713
pids
@@ -24,12 +20,11 @@ lib-cov
2420

2521
# Coverage directory used by tools like istanbul
2622
coverage
27-
*.lcov
2823

2924
# nyc test coverage
3025
.nyc_output
3126

32-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
27+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
3328
.grunt
3429

3530
# Bower dependency directory (https://bower.io/)
@@ -38,31 +33,45 @@ bower_components
3833
# node-waf configuration
3934
.lock-wscript
4035

41-
# Compiled binary addons (https://nodejs.org/api/addons.html)
42-
build/Release
36+
# IDEs and editors
37+
.idea
38+
.project
39+
.classpath
40+
.c9/
41+
*.launch
42+
.settings/
43+
*.sublime-workspace
44+
45+
# IDE - VSCode
46+
.vscode/*
47+
!.vscode/settings.json
48+
!.vscode/tasks.json
49+
!.vscode/launch.json
50+
!.vscode/extensions.json
51+
52+
# misc
53+
.sass-cache
54+
connect.lock
55+
typings
56+
57+
# Logs
58+
logs
59+
*.log
60+
npm-debug.log*
61+
yarn-debug.log*
62+
yarn-error.log*
63+
4364

4465
# Dependency directories
4566
node_modules/
4667
jspm_packages/
4768

48-
# TypeScript v1 declaration files
49-
typings/
50-
51-
# TypeScript cache
52-
*.tsbuildinfo
53-
5469
# Optional npm cache directory
5570
.npm
5671

5772
# Optional eslint cache
5873
.eslintcache
5974

60-
# Microbundle cache
61-
.rpt2_cache/
62-
.rts2_cache_cjs/
63-
.rts2_cache_es/
64-
.rts2_cache_umd/
65-
6675
# Optional REPL history
6776
.node_repl_history
6877

@@ -74,124 +83,61 @@ typings/
7483

7584
# dotenv environment variables file
7685
.env
77-
.env.test
7886

79-
# parcel-bundler cache (https://parceljs.org/)
80-
.cache
81-
82-
# Next.js build output
87+
# next.js build output
8388
.next
8489

85-
# Nuxt.js build / generate output
86-
.nuxt
87-
dist
88-
89-
# Gatsby files
90-
.cache/
91-
# Comment in the public line in if your project uses Gatsby and not Next.js
92-
# https://nextjs.org/blog/next-9-1#public-directory-support
93-
# public
94-
95-
# vuepress build output
96-
.vuepress/dist
97-
98-
# Serverless directories
99-
.serverless/
100-
101-
# FuseBox cache
102-
.fusebox/
103-
104-
# DynamoDB Local files
105-
.dynamodb/
106-
107-
# TernJS port file
108-
.tern-port
109-
110-
# Stores VSCode versions used for testing VSCode extensions
111-
.vscode-test
90+
# Lerna
91+
lerna-debug.log
11292

113-
# End of https://www.toptal.com/developers/gitignore/api/node
114-
115-
# Created by https://www.toptal.com/developers/gitignore/api/macos
116-
# Edit at https://www.toptal.com/developers/gitignore?templates=macos
117-
118-
### macOS ###
119-
# General
93+
# System Files
12094
.DS_Store
121-
.AppleDouble
122-
.LSOverride
123-
124-
# Icon must end with two
125-
Icon
126-
127-
128-
# Thumbnails
129-
._*
130-
131-
# Files that might appear in the root of a volume
132-
.DocumentRevisions-V100
133-
.fseventsd
134-
.Spotlight-V100
135-
.TemporaryItems
136-
.Trashes
137-
.VolumeIcon.icns
138-
.com.apple.timemachine.donotpresent
139-
140-
# Directories potentially created on remote AFP share
141-
.AppleDB
142-
.AppleDesktop
143-
Network Trash Folder
144-
Temporary Items
145-
.apdisk
146-
147-
### macOS Patch ###
148-
# iCloud generated files
149-
*.icloud
95+
Thumbs.db# -*- mode: gitignore; -*-
96+
*~
97+
\#*\#
98+
/.emacs.desktop
99+
/.emacs.desktop.lock
100+
*.elc
101+
auto-save-list
102+
tramp
103+
.\#*
150104

151-
# End of https://www.toptal.com/developers/gitignore/api/macos
105+
# Org-mode
106+
.org-id-locations
107+
*_archive
152108

153-
# Created by https://www.toptal.com/developers/gitignore/api/windows
154-
# Edit at https://www.toptal.com/developers/gitignore?templates=windows
109+
# flymake-mode
110+
*_flymake.*
155111

156-
### Windows ###
157-
# Windows thumbnail cache files
158-
Thumbs.db
159-
Thumbs.db:encryptable
160-
ehthumbs.db
161-
ehthumbs_vista.db
112+
# eshell files
113+
/eshell/history
114+
/eshell/lastdir
162115

163-
# Dump file
164-
*.stackdump
116+
# elpa packages
117+
/elpa/
165118

166-
# Folder config file
167-
[Dd]esktop.ini
119+
# reftex files
120+
*.rel
168121

169-
# Recycle Bin used on file shares
170-
$RECYCLE.BIN/
122+
# AUCTeX auto folder
123+
/auto/
171124

172-
# Windows Installer files
173-
*.cab
174-
*.msi
175-
*.msix
176-
*.msm
177-
*.msp
125+
# cask packages
126+
.cask/
127+
dist/
178128

179-
# Windows shortcuts
180-
*.lnk
129+
# Flycheck
130+
flycheck_*.el
181131

182-
# End of https://www.toptal.com/developers/gitignore/api/windows
132+
# server auth directory
133+
/server/
183134

184-
#Added by cargo
135+
# projectiles files
136+
.projectile
185137

186-
/target
187-
Cargo.lock
138+
# directory configuration
139+
.dir-locals.el
188140

189-
.pnp.*
190-
.yarn/*
191-
!.yarn/patches
192-
!.yarn/plugins
193-
!.yarn/releases
194-
!.yarn/sdks
195-
!.yarn/versions
141+
# network security
142+
/network-security.data
196143

197-
*.node

0 commit comments

Comments
 (0)