Skip to content

Commit

Permalink
Add standalone mode docs and ci job for testing
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Apr 12, 2022
1 parent 718663d commit 8e47826
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -389,3 +389,48 @@ jobs:
uses: docker/build-push-action@master
with:
context: .

standalone-kubernetes:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Uninstall moby
run: |
sudo apt-get purge -y moby-engine moby-cli moby-buildx
-
name: Setup k8s cluster
run: |
set -x
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo swapoff -a
sudo kubeadm init --cri-socket /run/containerd/containerd.sock
mkdir -p $HOME/.kube/
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $USER $HOME/.kube/config
kubectl taint nodes --all node-role.kubernetes.io/master-
kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
kubectl wait --for=condition=ready --timeout=30s node --all
kubectl get nodes -o wide
-
name: Create Dockerfile
run: |
cat > ./Dockerfile <<EOL
FROM alpine
RUN echo hello
EOL
-
name: Set up Docker Buildx
uses: ./
with:
standalone: true
driver: kubernetes
-
name: Build
run: |
buildx build .
29 changes: 29 additions & 0 deletions README.md
Expand Up @@ -24,6 +24,7 @@ ___
* [BuildKit daemon configuration](#buildkit-daemon-configuration)
* [Registry mirror](#registry-mirror)
* [Max parallelism](#max-parallelism)
* [Standalone mode](#standalone-mode)
* [Customizing](#customizing)
* [inputs](#inputs)
* [outputs](#outputs)
Expand Down Expand Up @@ -180,6 +181,34 @@ jobs:
config: .github/buildkitd.toml
```

### Standalone mode

If you don't have the Docker engine and CLI installed on your GitHub Runner,
you can use buildx in standalone mode. This can be useful if you want to use
the `kubernetes` driver in your self-hosted runner:

```yaml
name: ci

on:
push:

jobs:
buildx:
runs-on: ubuntu-latest
steps:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
standalone: true
driver: kubernetes
-
name: Build
run: |
buildx build .
```

## Customizing

### inputs
Expand Down

0 comments on commit 8e47826

Please sign in to comment.