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
|
- name: Hugo Build
|
||||||
run: hugo --minify
|
run: hugo --minify
|
||||||
|
|
||||||
- name: Install Buildah
|
- name: Build and Push Docker Image
|
||||||
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
|
|
||||||
env:
|
env:
|
||||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
# Login to Gitea Registry
|
# Find the Docker daemon (dind is on the gateway)
|
||||||
echo "$REGISTRY_TOKEN" | \
|
DOCKER_HOST_IP=$(ip route | grep default | awk '{print $3}')
|
||||||
buildah login ${{ env.REGISTRY }} -u luochen570 --password-stdin
|
export DOCKER_HOST="tcp://${DOCKER_HOST_IP}:2375"
|
||||||
|
echo "DOCKER_HOST=$DOCKER_HOST"
|
||||||
|
|
||||||
# Build container image (daemonless!)
|
# Login
|
||||||
buildah bud -t ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }} .
|
echo "$REGISTRY_TOKEN" | docker login $REGISTRY -u luochen570 --password-stdin
|
||||||
|
|
||||||
# Push to registry
|
# Build
|
||||||
buildah push ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }}
|
docker build -t $REGISTRY/$IMAGE:${{ github.sha }} .
|
||||||
# Also tag as latest
|
docker tag $REGISTRY/$IMAGE:${{ github.sha }} $REGISTRY/$IMAGE:latest
|
||||||
buildah tag ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }} \
|
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE }}:latest
|
# Push
|
||||||
buildah push ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest
|
docker push $REGISTRY/$IMAGE:${{ github.sha }}
|
||||||
|
docker push $REGISTRY/$IMAGE:latest
|
||||||
|
|
||||||
- name: Deploy to k3s
|
- name: Deploy to k3s
|
||||||
run: |
|
run: |
|
||||||
echo "kubectl deploy - skip for now, need runner kubectl access"
|
echo "Deploy step - skipped until runner kubectl is configured"
|
||||||
# kubectl set image deployment/hugo-blog -n hugo \
|
|
||||||
# nginx=${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user