Update Dockerfile #37
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 | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.actor }}/npc-template:latest | |
APP_DIR: apps/template | |
APP_PACKAGE_NAME: '@npc/template' | |
jobs: | |
publish: | |
name: Publish Image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login | |
run: | | |
echo ${{ secrets.PAT }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Build and Push Image | |
run: | | |
export TURBO_TEAM=${{ secrets.TURBO_TEAM }} TURBO_TOKEN=${{ secrets.TURBO_TOKEN }} APP_DIR=${{ env.APP_DIR }} APP_PACKAGE_NAME=${{ env.APP_PACKAGE_NAME }} IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
bash ./build.sh | |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
deploy: | |
needs: publish | |
name: Deploy Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to VPS | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
username: ${{ secrets.VPS_USER }} | |
key: ${{ secrets.VPS_SSH_KEY }} | |
port: ${{ secrets.VPS_PORT }} | |
script: | | |
cd ${{ secrets.VPS_WORK_DIR }} | |
docker compose pull | |
docker compose up -d | |
exit |