Skip to content

Commit

Permalink
adding docker build
Browse files Browse the repository at this point in the history
yarn no pnmp

docker

adding rust

update

adding ignore files

update image
  • Loading branch information
mike dupont committed Jan 14, 2025
1 parent 9a05f71 commit 172b383
Show file tree
Hide file tree
Showing 5 changed files with 251 additions and 131 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Dockerfile
.dockerignore
102 changes: 102 additions & 0 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@

name: Create and publish a Docker image

on:
workflow_dispatch:
push:
# pull_request:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
ECR_REPOSITORY: nodemodules/tokenizer
DOCKER_REPOSITORY: h4ckermike/arm64-tokenizers
SESSION_APP_NAME: tokenizer

jobs:

build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- name: Configure AWS credentials
uses: meta-introspector/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.AWS_REGION || 'us-east-2'}}
role-session-name: github-actions-${{ env.SESSION_APP_NAME }}
# FIXME hard coded
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID || '767503528736' }}:role/github

- name: Set up Docker Buildx
uses: meta-introspector/[email protected]
with:
install: true
platforms: linux/amd64,linux/arm/v7,linux/arm/v8

- name: Login to Amazon ECR
id: login-ecr
uses: meta-introspector/amazon-ecr-login@v1
- uses: meta-introspector/create-ecr-repository-action@v1
with:
repository: ${{ env.ECR_REPOSITORY }}

- name: Set short sha
id: sha_short
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Login to Docker Hub
uses: meta-introspector/login-action@v3
with:
username: ${{ vars.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Checkout repository
uses: meta-introspector/checkout@v4

- name: Log in to the Container registry
uses: meta-introspector/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: meta-introspector/[email protected]
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
${{ env.DOCKER_REPOSITORY}}
${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY}}
- name: Build and push Docker image
id: push
uses: meta-introspector/[email protected]
with:
platforms: linux/arm64,linux/arm64/v8
context: .
push: true
tags: |
${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
uses: meta-introspector/attest-build-provenance@local
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

- name: Make Docker image public
run: |
curl \
-X PATCH \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/user/packages/container/${{ env.IMAGE_NAME }}/visibility \
-d '{"visibility":"public"}'
208 changes: 77 additions & 131 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# Created by https://www.toptal.com/developers/gitignore/api/node
# Edit at https://www.toptal.com/developers/gitignore?templates=node
# See http://help.github.com/ignore-files/ for more about ignoring files.

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# compiled output
/dist
/tmp
/out-tsc
/lib

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

# Runtime data
pids
Expand All @@ -24,12 +20,11 @@ lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

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

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

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# IDEs and editors
.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
.sass-cache
connect.lock
typings

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*


# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

Expand All @@ -74,124 +83,61 @@ typings/

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
# next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# Lerna
lerna-debug.log

# End of https://www.toptal.com/developers/gitignore/api/node

# Created by https://www.toptal.com/developers/gitignore/api/macos
# Edit at https://www.toptal.com/developers/gitignore?templates=macos

### macOS ###
# General
# System Files
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud
Thumbs.db# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*

# End of https://www.toptal.com/developers/gitignore/api/macos
# Org-mode
.org-id-locations
*_archive

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

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# eshell files
/eshell/history
/eshell/lastdir

# Dump file
*.stackdump
# elpa packages
/elpa/

# Folder config file
[Dd]esktop.ini
# reftex files
*.rel

# Recycle Bin used on file shares
$RECYCLE.BIN/
# AUCTeX auto folder
/auto/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# cask packages
.cask/
dist/

# Windows shortcuts
*.lnk
# Flycheck
flycheck_*.el

# End of https://www.toptal.com/developers/gitignore/api/windows
# server auth directory
/server/

#Added by cargo
# projectiles files
.projectile

/target
Cargo.lock
# directory configuration
.dir-locals.el

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
# network security
/network-security.data

*.node
Loading

0 comments on commit 172b383

Please sign in to comment.