update dev.db #5
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 Next.js App | |
on: | |
push: | |
branches: | |
- main # or your default branch | |
jobs: | |
build_and_push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASS }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: joejoeelephant/flashcard:latest # Replace 'username' with your Docker Hub username. | |
deploy: | |
needs: build_and_push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
key: ${{ secrets.DEPLOY_KEY }} | |
port: ${{ secrets.REMOTE_PORT }} | |
script: | | |
docker pull joejoeelephant/flashcard:latest | |
docker stop flash-card-container || true | |
docker rm flash-card-container || true | |
docker run -d -v ~/flashCard/flashcards/.env:/usr/src/app/.env --name flash-card-container -p ${{ secrets.REMOTE_PROXY_PORT }}:3000 joejoeelephant/flashcard:latest |