-Service- Frontend #10
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: -Service- Frontend | |
on: | |
workflow_dispatch | |
jobs: | |
build-and-deploy-frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./frontend | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/dhammanava-frontend-image:latest | |
- name: Deploy to Ubuntu server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{secrets.LINUX_HOST}} | |
username: ${{secrets.LINUX_USERNAME}} | |
key: ${{ secrets.LINUX_PRIVATE_KEY }} | |
script: | | |
docker stop frontend-container || true | |
docker rm frontend-container || true | |
docker image rm ${{ secrets.DOCKERHUB_USERNAME }}/dhammanava-frontend-image:latest | |
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/dhammanava-frontend-image:latest | |
cd dhammanava-search | |
docker compose -f docker-compose.prod.yml up -d frontend |