Skip to content

feat: update readme #24

feat: update readme

feat: update readme #24

Workflow file for this run

name: CI
# TODO: only run when server or .github directory contents change
on:
push:
branches:
- main
paths:
- 'server/**'
- '.github/**'
pull_request:
branches:
- main
paths:
- 'server/**'
- '.github/**'
jobs:
build-and-push:
env:
IMAGE: "${{ vars.DOCKERHUB_USERNAME }}/${{ vars.DOCKERHUB_REPO }}:${{ github.ref_name }}-${{ github.sha }}"
defaults:
run:
working-directory: server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github
server
- uses: azure/k8s-set-context@v4
with:
kubeconfig: ${{ secrets.LINODE_KUBECONFIG }} # must be the kubeconfig itself, not the path to it
- name: Build the Docker Image
run: docker build -f Dockerfile.prod -t ${{ env.IMAGE }} --build-arg FIREBASE_SERVICE_ACCOUNT_KEY_BASE64="${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY_BASE64}}" .
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push the Docker Image
run: docker push ${{ env.IMAGE }}
- name: Create namespace
run: kubectl apply -f k8s/spaces_ns.yml
- name: Set new current namespace
run: kubectl config set-context --current --namespace=spaces
- name: Create Dockerhub secret
run: |
sed -i'' \
-e "s/DOCKERHUB_SECRET/$(cat ~/.docker/config.json | base64 -w 0)/g" \
k8s/spaces-dockerhub_secret.yml
kubectl apply -f k8s/spaces-dockerhub_secret.yml
- name: Apply Deployment
run: |
sed -i'' \
-e "s|DOCKERHUB_IMAGE|${{ env.IMAGE }}|g" \
k8s/spaces-prod_deploy.yml
kubectl apply -f k8s/spaces-prod_deploy.yml
- name: Apply Service
run: kubectl apply -f k8s/spaces-prod_svc.yml
- name: Delete old Images on Docker Hub
run: /bin/bash bash_scripts/delete_old_images/delete_old_images.sh
env:
REGEX: "${{ github.ref_name }}-"
DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_USERNAME }}
DOCKERHUB_REPO: ${{ vars.DOCKERHUB_REPO }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}