Skip to content

feat: Implement inventory update by product ID #10

feat: Implement inventory update by product ID

feat: Implement inventory update by product ID #10

Workflow file for this run

name: Deploy to VM
on:
push:
branches:
- master # Adjust this to your deployment branch
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
push: true
tags: indrafajar/nest-pos-be:latest # Update this
- name: Deploy to VM
env:
SSH_PRIVATE_KEY: ${{ secrets.VM_SSH_KEY }}
HOST: ${{ secrets.VM_HOST }} # Update with your VM IP
USER: ${{ secrets.VM_USERNAME }}
run: |
echo "${SSH_PRIVATE_KEY}" > /tmp/vm_key
chmod 600 /tmp/vm_key
ssh -o StrictHostKeyChecking=no -i /tmp/vm_key $USER@$HOST << 'EOF'
docker pull indrafajar/nest-pos-be:latest
docker stop mynest || true
docker rm mynest || true
docker run -d --name mynest --env-file ~/nest-pos-be/.env --restart unless-stopped --network pos-app -p 3000:3000 indrafajar/nest-pos-be:latest
docker image prune -f
EOF