Skip to content

feat: add var to authform #258

feat: add var to authform

feat: add var to authform #258

Workflow file for this run

name: Frontend CI/CD
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Create .env.production
run: echo "VITE_API_BASE_URL=${{ secrets.VITE_API_BASE_URL }}" > .env.production
- name: Build frontend
run: npm run build
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
- name: Build Docker image
run: docker build --build-arg VITE_API_BASE_URL=${{ secrets.VITE_API_BASE_URL }} -t ${{ secrets.DOCKERHUB_USERNAME }}/blaybus-frontend:latest .
- name: Push Docker image to Docker Hub
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/blaybus-frontend:latest
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.KEY }}
envs: GITHUB_SHA
script: |
cd /home/ubuntu/galaxyDev
echo "🛑 Stopping and removing existing backend-container"
docker-compose down frontend-container
echo "🚀 Updating to the backend-container:latest image"
docker-compose pull frontend-container
echo "✅ Starting the new container"
docker-compose up -d frontend-container