Skip to content

Commit

Permalink
infra: Add ci docker image builder
Browse files Browse the repository at this point in the history
  • Loading branch information
BasedDepartment1 committed Nov 5, 2023
1 parent 4c5f8c3 commit 179700e
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/deploy-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Deploy Backend

on:
workflow_dispatch:
inputs:
tag:
required: true
type: string
description: Docker image tag for container registry

env:
IMAGE_NAME: backend

jobs:
build:
runs-on: ubuntu-latest
container:
image: gcr.io/kaniko-project/executor:debug
options: "--entrypoint=''"
steps:
- uses: actions/checkout@v4

- name: Authentificate in container registry
run: |
mkdir -p /kaniko/.docker
echo "{\"auths\":{\"${{ secrets.CI_REGISTRY }}\":{\"auth\":\"$(echo -n "json_key:${{ secrets.CI_REGISTRY_KEY }}" | base64 | tr -d '\n' )\"}}}" > /kaniko/.docker/config.json
- name: Build and push
run: >-
/kaniko/executor
--context "."
--dockerfile "./Dockerfile"
--destination "${{ secrets.CI_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.tag }}"
27 changes: 27 additions & 0 deletions infra/k8s/service-account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: admin-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: admin-user
namespace: kube-system
---
apiVersion: v1
kind: Secret
type: kubernetes.io/service-account-token
metadata:
name: admin-user-token
namespace: kube-system
annotations:
kubernetes.io/service-account.name: "admin-user"

0 comments on commit 179700e

Please sign in to comment.