ci: use dind Docker API via gateway IP (port 2375)
Some checks failed
Deploy Hugo Blog to k3s / build-and-deploy (push) Failing after 31s
Some checks failed
Deploy Hugo Blog to k3s / build-and-deploy (push) Failing after 31s
This commit is contained in:
@@ -28,34 +28,26 @@ jobs:
|
||||
- name: Hugo Build
|
||||
run: hugo --minify
|
||||
|
||||
- name: Install Buildah
|
||||
run: |
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq buildah fuse-overlayfs uidmap
|
||||
# Configure storage
|
||||
mkdir -p /root/.local/share/containers
|
||||
buildah version
|
||||
|
||||
- name: Build and Push with Buildah
|
||||
- name: Build and Push Docker Image
|
||||
env:
|
||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
run: |
|
||||
# Login to Gitea Registry
|
||||
echo "$REGISTRY_TOKEN" | \
|
||||
buildah login ${{ env.REGISTRY }} -u luochen570 --password-stdin
|
||||
# Find the Docker daemon (dind is on the gateway)
|
||||
DOCKER_HOST_IP=$(ip route | grep default | awk '{print $3}')
|
||||
export DOCKER_HOST="tcp://${DOCKER_HOST_IP}:2375"
|
||||
echo "DOCKER_HOST=$DOCKER_HOST"
|
||||
|
||||
# Build container image (daemonless!)
|
||||
buildah bud -t ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }} .
|
||||
# Login
|
||||
echo "$REGISTRY_TOKEN" | docker login $REGISTRY -u luochen570 --password-stdin
|
||||
|
||||
# Push to registry
|
||||
buildah push ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }}
|
||||
# Also tag as latest
|
||||
buildah tag ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }} \
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE }}:latest
|
||||
buildah push ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest
|
||||
# Build
|
||||
docker build -t $REGISTRY/$IMAGE:${{ github.sha }} .
|
||||
docker tag $REGISTRY/$IMAGE:${{ github.sha }} $REGISTRY/$IMAGE:latest
|
||||
|
||||
# Push
|
||||
docker push $REGISTRY/$IMAGE:${{ github.sha }}
|
||||
docker push $REGISTRY/$IMAGE:latest
|
||||
|
||||
- name: Deploy to k3s
|
||||
run: |
|
||||
echo "kubectl deploy - skip for now, need runner kubectl access"
|
||||
# kubectl set image deployment/hugo-blog -n hugo \
|
||||
# nginx=${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }}
|
||||
echo "Deploy step - skipped until runner kubectl is configured"
|
||||
|
||||
Reference in New Issue
Block a user