52 lines
937 B
YAML
52 lines
937 B
YAML
name: Build and Push
|
|
|
|
on: [push]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: buildkit # Matches the label you just fixed!
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Build via remote BuildKit
|
|
|
|
run: |
|
|
|
|
# 1. Provide Registry Credentials
|
|
|
|
# BuildKit needs a ~/.docker/config.json to push to a private registry.
|
|
|
|
# If your registry is public or uses Node-level auth, you can skip this.
|
|
|
|
mkdir -p ~/.docker
|
|
|
|
echo '{"auths":{"registry.yourdomain.com":{"auth":"$(echo -n "username:password" | base64)"}}}' > ~/.docker/config.json
|
|
|
|
|
|
|
|
# 2. Execute Build
|
|
|
|
buildctl \
|
|
|
|
--addr tcp://buildkit.default.svc.cluster.local:1234 \
|
|
|
|
build \
|
|
|
|
--frontend dockerfile.v0 \
|
|
|
|
--local context=. \
|
|
|
|
--local dockerfile=. \
|
|
|
|
--output type=image,name=registry/myapp:latest,push=true
|