目錄

ghcr.io Pack Build

目錄

Github 提供了開源的專案免費的 registry,所以寫個文章來記錄一下,如果使用 .github/workflows/build.yml 中使用 pack 來構建 container image

name: Build
on:
push:
branches:
- master
jobs:
build-oci:
name: build container image
runs-on: ubuntu-latest
steps:
- id: checkout
name: Checkout code
uses: actions/checkout@v2
- name: Login to GitHub Package Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- id: setup-pack
uses: buildpacks/github-actions/setup-pack@v4.1.0
- id: package
run: |
#!/usr/bin/env bash
set -euo pipefail
pack build --builder ${BUILDER} --env GOOGLE_BUILDABLE=cmd/add/main.go --publish ${IMAGE}
shell: bash
env:
BUILDER: gcr.io/buildpacks/builder:v1
IMAGE: ghcr.io/${{ github.repository_owner }}/<replace-image-name>
view raw build.yml hosted with ❤ by GitHub