This commit is contained in:
@@ -1,71 +1,36 @@
|
|||||||
name: Build Dockerfile with Remote BuildKit
|
name: Build Dockerfile with Remote BuildKit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
|
||||||
push:
|
push:
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
|
|
||||||
- main
|
- main
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
|
||||||
# Must match runner labels exactly
|
# Must match runner labels exactly
|
||||||
|
|
||||||
runs-on: ["buildkit"]
|
runs-on: ["buildkit"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
# Checkout the repo
|
# Checkout the repo
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Install buildctl if not already installed
|
# Install buildctl if not already installed
|
||||||
|
|
||||||
- name: Install buildctl
|
- name: Install buildctl
|
||||||
|
|
||||||
run: |
|
run: |
|
||||||
|
|
||||||
if ! command -v buildctl &> /dev/null; then
|
if ! command -v buildctl &> /dev/null; then
|
||||||
|
|
||||||
echo "Installing buildctl..."
|
echo "Installing buildctl..."
|
||||||
|
|
||||||
wget -qO- https://github.com/moby/buildkit/releases/download/v0.12.5/buildkit-v0.12.5.linux-amd64.tar.gz \
|
wget -qO- https://github.com/moby/buildkit/releases/download/v0.12.5/buildkit-v0.12.5.linux-amd64.tar.gz \
|
||||||
|
|
||||||
| tar -xz -C /usr/local/bin --strip-components=1 bin/buildctl
|
| tar -xz -C /usr/local/bin --strip-components=1 bin/buildctl
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Build and push image using remote BuildKit
|
# Build and push image using remote BuildKit
|
||||||
|
|
||||||
- name: Build and Push Dockerfile
|
- name: Build and Push Dockerfile
|
||||||
|
|
||||||
run: |
|
run: |
|
||||||
|
|
||||||
buildctl \
|
buildctl \
|
||||||
|
|
||||||
--addr tcp://buildkit.default.svc.cluster.local:1234 \
|
--addr tcp://buildkit.default.svc.cluster.local:1234 \
|
||||||
|
|
||||||
build \
|
build \
|
||||||
|
|
||||||
--frontend dockerfile.v0 \
|
--frontend dockerfile.v0 \
|
||||||
|
|
||||||
--local context=. \
|
--local context=. \
|
||||||
|
|
||||||
--local dockerfile=. \
|
--local dockerfile=. \
|
||||||
|
|
||||||
--output type=image,name=registry/myapp:latest,push=true
|
--output type=image,name=registry/myapp:latest,push=true
|
||||||
|
|||||||
Reference in New Issue
Block a user