๐ Docs: Update README.md #53
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: Deploy Frontend on Server via DockerHub | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
env: | |
HOST: ${{ secrets.HOST }} | |
USERNAME: ${{ secrets.USERNAME }} | |
KEY: ${{ secrets.SSH_KEY }} | |
PORT: ${{ secrets.PORT }} | |
INSTANCE_PATH: ./AEYE-INFRA/frontend | |
IMAGE_NAME: shinsion/aeye-client | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout source code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Docker image build and push | |
run: | | |
docker build -t ${{ env.IMAGE_NAME }} . | |
docker push ${{ env.IMAGE_NAME }} | |
- name: Pull Docker image to Server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ env.HOST }} | |
username: ${{ env.USERNAME }} | |
key: ${{ env.KEY }} | |
port: ${{ env.PORT }} | |
script: | | |
cd ${{ env.INSTANCE_PATH }} | |
docker stop aeye-frontend-client | |
docker rm aeye-frontend-client | |
docker rmi ${{ env.IMAGE_NAME }}:latest | |
docker compose up -d |