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 e2b514f
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -389,3 +389,81 @@ 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-.*' containernetworking-plugins buildah podman
-
name: Install containerd
run: |
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends --allow-downgrades containerd
-
name: Set up containerd
run: |
sudo mkdir -p /mnt/containerd
cat << EOF | sudo tee /etc/containerd/config.toml
version = 2
root = "/mnt/containerd"
[plugins]
[plugins."io.containerd.grpc.v1.cri"]
[plugins."io.containerd.grpc.v1.cri".cni]
bin_dir = "/opt/cni/bin/"
conf_dir = "/etc/cni/net.d"
[plugins."io.containerd.internal.v1.opt"]
path = "/var/lib/containerd/opt"
EOF
sudo systemctl restart containerd
-
name: Install kubernetes
run: |
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
cat << EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends --allow-downgrades kubeadm
-
name: Bootstrap kubernetes
run: |
sudo kubeadm init --pod-network-cidr=192.168.0.0/16 --cri-socket=unix:///run/containerd/containerd.sock
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl taint nodes --all node-role.kubernetes.io/master-
kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
-
name: Check status
timeout-minutes: 15
run: |
kubectl get --show-labels -o wide --all-namespaces all
kubectl wait --for condition=available --timeout=600s -n kube-system deployments --all
kubectl wait --for condition=ready --timeout=600s -n kube-system pods --all
kubectl get --show-labels -o wide nodes
kubectl get --show-labels -o wide -n kube-system deployments
kubectl get --show-labels -o wide -n kube-system daemonsets
kubectl get --show-labels -o wide --all-namespaces pods
-
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 your runner does not have the Docker engine and CLI installed, you can use
buildx in standalone mode. It 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 e2b514f

Please sign in to comment.