Skip to content

Commit

Permalink
fix : docker hub 이름 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
jiji-hoon96 committed Aug 12, 2024
1 parent c87ea3d commit 949c127
Showing 1 changed file with 9 additions and 28 deletions.
37 changes: 9 additions & 28 deletions .github/workflows/deploy-main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
name: Deploy to Docker Hub

on:
push:
branches: [main]

jobs:
build-and-push:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code'
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Docker Buildx
- name: Set up Docker
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
Expand All @@ -21,27 +19,11 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/nextjs-app:latest

deploy:
needs: build-and-push
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Copy docker-compose file to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_SSH_KEY }}
source: 'docker-compose.yml'
target: '~/app'
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
run: |
docker build -t $DOCKERHUB_USERNAME/snappy:latest .
docker push $DOCKERHUB_USERNAME/snappy:latest
- name: Deploy to server
uses: appleboy/ssh-action@master
Expand All @@ -50,6 +32,5 @@ jobs:
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_SSH_KEY }}
script: |
cd ~/app
docker-compose pull
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/snappy:latest
docker-compose up -d

0 comments on commit 949c127

Please sign in to comment.