Skip to content

Commit

Permalink
cd fix
Browse files Browse the repository at this point in the history
  • Loading branch information
eun-hak committed Jul 1, 2024
1 parent f2609aa commit 441f276
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/cd-aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
with:
context: .
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/nextjs-app:latest
tags: ${{ secrets.DOCKER_USERNAME }}/vite-react-app:latest

- name: Logout from Docker Hub
run: docker logout
Expand All @@ -49,17 +49,14 @@ jobs:
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} << 'EOF'
# Pull the latest Docker image
docker pull ${{ secrets.DOCKER_USERNAME }}/nextjs-app:latest
docker pull ${{ secrets.DOCKER_USERNAME }}/vite-react-app:latest
# Stop the currently running container
docker stop nextjs-app || true
docker stop vite-react-app || true
# Remove the stopped container
docker rm nextjs-app || true
docker rm vite-react-app || true
# Run the new container
docker run -d -p 3000:3000 --name nextjs-app ${{ secrets.DOCKER_USERNAME }}/nextjs-app:latest
# Restart PM2 to apply the new Docker container
pm2 restart all
# Run the new container with PM2
docker run -d -p 3000:3000 --name vite-react-app ${{ secrets.DOCKER_USERNAME }}/vite-react-app:latest
EOF
2 changes: 2 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
run: apk add ruby && gem install mustache
- name: creates output
run: sh ./build.sh
- name: Copy cd-aws.yml to output
run: cp .github/workflows/cd-aws.yml output/cd-aws.yml
- name: Pushes to another repository
id: push_directory
uses: cpina/github-action-push-to-another-repository@main
Expand Down
1 change: 1 addition & 0 deletions ecosystem.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*eslint no-undef: "off"*/
module.exports = {
apps: [
{
Expand Down

0 comments on commit 441f276

Please sign in to comment.