diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..bca8cf7 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,46 @@ +name: Build the portfolio website +on: + workflow_dispatch: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build-portfolio-website: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '20' + + - name: Install dependencies + run: npm install + + - name: Build the project + run: npm run build + + build-and-push-docker-image: + runs-on: ubuntu-latest + steps: + - name: Login to Docker registry + uses: docker/login-action@v2 + with: + registry: ${{ secrets.DOCKER_REGISTRY }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build Docker image + uses: docker/build-push-action@v4 + with: + context: . + file: Dockerfile + push: true + tags: ${{ secrets.DOCKER_REGISTRY }}/my-portfolio:latest + diff --git a/scripts/create_kubeconfig.sh b/scripts/create_kubeconfig.sh new file mode 100755 index 0000000..06f21f9 --- /dev/null +++ b/scripts/create_kubeconfig.sh @@ -0,0 +1,140 @@ +#!/usr/bin/env bash + +function usage() { + echo "--namespace --user --kubeconfig " +} + +function create_namespace() { + local namespace="$1" + kubectl create namespace "$namespace" \ + --dry-run=client -o yaml | kubectl apply -f - +} + +function create_service_account() { + local user="$1" + local namespace="$2" + + kubectl create serviceaccount "$user" \ + --namespace "$namespace" \ + --dry-run=client -o yaml | kubectl apply -f - + + # Create associated secret + kubectl apply -f - <"${kubeconfig}" <