Some checks failed
Testing Gitea Actions / Build (push) Failing after 0s
46 lines
1.5 KiB
YAML
46 lines
1.5 KiB
YAML
name: Testing Gitea Actions
|
|
run-name: Building images in ${{ gitea.repository }}
|
|
on: [push]
|
|
|
|
jobs:
|
|
Build:
|
|
runs-on: ubuntu-latest
|
|
|
|
# services:
|
|
# docker:
|
|
# image: docker:dind
|
|
|
|
# env:
|
|
# DOCKER_HOST: tcp://docker:2376
|
|
# DOCKER_TLS_VERIFY: ""
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# - name: Set up Docker Buildx
|
|
# uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
driver: kubernetes
|
|
driver-opts: |
|
|
namespace=gitea
|
|
run: |
|
|
export KUBECONFIG=$HOME/.kube/config
|
|
mkdir -p $HOME/.kube
|
|
kubectl config set-cluster ccp --server=https://kubernetes.default.svc --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
|
|
kubectl config set-context ccp --cluster=ccp --user=admin --namespace=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
|
|
kubectl config set-credentials admin --token=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
|
|
kubectl config use-context ccp
|
|
|
|
docker buildx create --name kube-builder --driver kubernetes --platform linux/amd64
|
|
|
|
- name: Build Docker Image
|
|
env:
|
|
BRANCH_NAME: ${{ github.ref_name }}
|
|
SHORT_HASH: ${{ github.sha }}
|
|
run: |
|
|
# Build the image with the commit hash tag
|
|
docker build -t test-image:${BRANCH_NAME}-${SHORT_HASH:0:5} .
|