Merge pull request #188 from luxfi/fix/server-compile-issues #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image CI for GHCR for Bridge Server | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "server/**" # Only trigger the workflow for changes in the server directory | |
jobs: | |
build_and_publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: | | |
corepack enable | |
pnpm install | |
working-directory: server | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to GitHub Container Registry | |
run: | | |
docker login --username "${{ secrets.GH_USER }}" --password "${{ secrets.GH_TOKEN }}" ghcr.io | |
- name: Run Docker build and push with pnpm script | |
run: | | |
pnpm docker:build && pnpm docker:push | |
working-directory: server | |
deploy: | |
needs: build_and_publish | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Set up kubectl | |
uses: azure/setup-kubectl@v3 | |
with: | |
version: v1.30.6 | |
- name: Deploy to Kubernetes | |
env: | |
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} | |
run: | | |
pnpm k8s:apply | |
working-directory: server |