Skip to content

refactor: Update Nginx proxy settings for WebSocket and API routes #97

refactor: Update Nginx proxy settings for WebSocket and API routes

refactor: Update Nginx proxy settings for WebSocket and API routes #97

Workflow file for this run

name: Client CI/CD
on:
push:
branches: [develop]
paths:
- 'client/**'
- 'core/**'
- 'nginx.conf'
- '.github/workflows/client-ci-cd.yml'
- 'Dockerfile.nginx'
- 'docker-compose.yml'
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: '9'
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build Core Package
working-directory: ./core
run: pnpm build
- name: Lint Client
working-directory: ./client
run: pnpm lint | true
- name: Test Client
working-directory: ./client
run: pnpm test | true
docker-deploy:
needs: ci
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Docker Setup
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.nginx
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/troublepainter-nginx:latest
build-args: |
VITE_API_URL=${{secrets.VITE_API_URL}}
VITE_SOCKET_URL=${{secrets.VITE_SOCKET_URL}}
- name: Deploy to Server
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: mira
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /home/mira/web30-stop-troublepainter
export DOCKERHUB_USERNAME=${{ secrets.DOCKERHUB_USERNAME }}
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/troublepainter-nginx:latest
docker compose up -d nginx