FEAT: Add compose file #14
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: Build and Deploy to Docker Hub | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 # Clone the Repository | |
- 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@v6 | |
with: | |
context: . | |
file: ./web/Dockerfile | |
push: true | |
tags: thinley44/dchat-web:latest | |
- name: Verify Pushed Image | |
run: docker pull thinley44/dchat-web:latest | |
- name: Deploy to Server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
script: | | |
cd composeFile/compose.yml | |
sudo docker-compose pull | |
sudo docker-compose up -d | |
# script: | | |
# sudo docker pull thinley44/dchat-web:latest | |
# sudo docker stop dchat-web || true | |
# sudo docker rm dchat-web || true | |
# sudo docker run -d --name dchat-web -p 3000:3000 thinley44/dchat-web:latest |