[fix] baseUrl 작성 #34
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: issue-tracking-system-nextjs CI/CD | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install dependencies | |
run: npm install | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build Docker image | |
run: docker build --build-arg NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL }} -t ${{ secrets.DOCKERHUB_USERNAME }}/issue-tracking-system-nextjs:latest . | |
- name: Push Docker image | |
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/issue-tracking-system-nextjs:latest | |
- name: Deploy to EC2 | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.EC2_HOST }} | |
username: ubuntu | |
key: ${{ secrets.EC2_KEY }} | |
script: | | |
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/issue-tracking-system-nextjs:latest | |
docker stop issue-tracking-system-nextjs || true | |
docker rm issue-tracking-system-nextjs || true | |
docker run -d -p 80:3000 --name issue-tracking-system-nextjs \ | |
-e NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL }} \ | |
${{ secrets.DOCKERHUB_USERNAME }}/issue-tracking-system-nextjs:latest | |
sleep 10 | |
docker logs issue-tracking-system-nextjs |