Skip to content

feat: ⚡ improve perf #24

feat: ⚡ improve perf

feat: ⚡ improve perf #24

Workflow file for this run

name: build
on:
push:
branches:
- master
jobs:
create-docker-image-front:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
- name: Login to GitHub Container Registry (with lowercase username)
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }} # Convert username to lowercase
password: ${{ secrets.GH_TOKEN }}
- name: Build and push comandera
uses: docker/build-push-action@v2
with:
context: .
file: ./front.Dockerfile
push: true
tags: ghcr.io/elimeleth/ft-comandera:latest # Use lowercase username in tag
continue-on-error: false
create-docker-image-backend:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
- name: Login to GitHub Container Registry (with lowercase username)
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }} # Convert username to lowercase
password: ${{ secrets.GH_TOKEN }}
- name: Build and push comandera
uses: docker/build-push-action@v2
with:
context: .
file: ./api.Dockerfile
push: true
tags: ghcr.io/elimeleth/bc-comandera:latest # Use lowercase username in tag
continue-on-error: false
deploy-backend:
needs: create-docker-image-backend
runs-on: ubuntu-latest
steps:
- name: Install sshpass
run: sudo apt-get install -y sshpass
- name: SSH into Server (with lowercase username in Docker commands)
run: |
sshpass -p ${{secrets.AUTH_PASS}} ssh -o StrictHostKeyChecking=no ${{secrets.AUTH_SERVER}} << EOF
cd /home/comandera/
docker login ghcr.io -u elimeleth -p ${{secrets.GH_TOKEN}}
docker pull ghcr.io/elimeleth/bc-comandera:latest
docker rm -f bc-comandera 2>/dev/null
docker run -d \
--name bc-comandera \
--user 0:0 \
-p 5000:5000 \
--cap-add=SYS_ADMIN \
-e DB_USER=${{secrets.DB_USER}} \
-e DB_HOST=${{secrets.DB_HOST}} \
-e DB_NAME=${{secrets.DB_NAME}} \
-e DB_PASSWORD=${{secrets.DB_PASSWORD}} \
-e DB_DIALECT=${{secrets.DB_DIALECT}} \
-e DB_PORT=${{secrets.DB_PORT}} \
-e NODE_ENV=development \
-e PORT=5000 \
-e JWT_SECRET=abc123 \
--restart always \
ghcr.io/elimeleth/bc-comandera:latest
EOF
deploy-front:
needs: create-docker-image-front
runs-on: ubuntu-latest
steps:
- name: Install sshpass
run: sudo apt-get install -y sshpass
- name: SSH into Server (with lowercase username in Docker commands)
run: |
sshpass -p ${{secrets.AUTH_PASS}} ssh -o StrictHostKeyChecking=no ${{secrets.AUTH_SERVER}} << EOF
cd /home/comandera/
docker login ghcr.io -u elimeleth -p ${{secrets.GH_TOKEN}}
docker pull ghcr.io/elimeleth/ft-comandera:latest
docker rm -f ft-comandera 2>/dev/null
docker run -d \
--name ft-comandera \
--user 0:0 \
-p 3000:3000 \
--cap-add=SYS_ADMIN \
--restart always \
ghcr.io/elimeleth/ft-comandera:latest
EOF