Skip to content

GitHub Container Registry へ push するようにしてみる #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Feb 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/akane-next-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,55 @@ jobs:
run: npm run lint -w packages/akane-next
- name: Test
run: npm run test -w packages/akane-next
- name: Build
run: npm run build -w packages/akane-next

build-and-push:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pull-requests: read
id-token: write
actions: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v4
id: meta
with:
images: ghcr.io/${{ github.repository }}/akane-next
# デフォルトブランチの時だけ latest タグをつけてそれ以外は日時とコミットハッシュをつける
# ref: https://github.com/docker/metadata-action?tab=readme-ov-file#customizing
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value={{date 'YYYYMMDD-HHmmss' tz='Asia/Tokyo'}}-{{sha}}
# Open Container Initiative (OCI) の Image Spec に基づくラベル
# ref:
# - https://github.com/opencontainers/image-spec/blob/fbb4662eb53b80bd38f7597406cf1211317768f0/annotations.md?plain=1#L18-L26
labels: |
org.opencontainers.image.authors="rokuosan, taiseiue, nenrinyear, Retasusan, ikotome"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[コメント] 外部の標準への準拠助かります。他の人がコードやイメージを見直したときに伝わりやすくなります😊

org.opencontainers.image.url="https://github.com/kc3hack/2025_9"
org.opencontainers.image.documentation="https://github.com/kc3hack/2025_9"
org.opencontainers.image.source="https://github.com/kc3hack/2025_9"
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./packages/akane-next
file: ./docker/akane-next/Dockerfile
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
provenance: false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[メモ] GitHub Container Registryへの対応のため、暫定的にprovenance: falseを指定している

env:
NODE_ENV: production
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}