-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (35 loc) · 1.3 KB
/
frontend-deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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