diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index fd938b84..d3215795 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -20,18 +20,12 @@ jobs: - name: Docker build and Push run: | - docker build -t ${{ secrets.DOCKER_USERNAME }}/meetfolio-web:latest . + docker build \ + --build-arg NEXT_PUBLIC_SERVER=${{ secrets.NEXT_PUBLIC_SERVER }} \ + --build-arg NEXT_PUBLIC_NEXT_SERVER=${{ secrets.NEXT_PUBLIC_NEXT_SERVER }} \ + -t ${{ secrets.DOCKER_USERNAME }}/meetfolio-web:latest . docker push ${{secrets.DOCKER_USERNAME}}/meetfolio-web:latest - - name: Set ENV - env: - NEXT_PUBLIC_SERVER: ${{ secrets.NEXT_PUBLIC_SERVER }} - NEXT_PUBLIC_NEXT_SERVER: ${{ secrets.NEXT_PUBLIC_NEXT_SERVER }} - run: | - echo "NEXT_PUBLIC_SERVER=$NEXT_PUBLIC_SERVER" > myfile - echo "NEXT_PUBLIC_NEXT_SERVER=$NEXT_PUBLIC_NEXT_SERVER" >> myfile - cat myfile - - name: Deploy in GCP uses: appleboy/ssh-action@master with: @@ -39,14 +33,8 @@ jobs: username: ${{ secrets.SSH_USERNAME }} key: ${{ secrets.SSH_PRIVATE_KEY }} script: | - rm -rf .env.local - echo "NEXT_PUBLIC_SERVER=${{ secrets.NEXT_PUBLIC_SERVER }}" > .env.local - echo "NEXT_PUBLIC_NEXT_SERVER=${{ secrets.NEXT_PUBLIC_NEXT_SERVER }}" >> .env.local - cat .env.local - echo "ENVFILE: /home/meetfolio4/.env.local" sudo docker pull ${{ secrets.DOCKER_USERNAME }}/meetfolio-web:latest sudo docker tag ${{ secrets.DOCKER_USERNAME }}/meetfolio-web:latest meetfolio-web:latest sudo docker rm -f meetfolio-web sudo docker run -d --name meetfolio-web -e TZ=Asia/Seoul -e PORT=60005 -p 60005:60005 meetfolio-web:latest - sudo docker cp /home/meetfolio4/.env.local meetfolio-web:/usr/src/app/.env.local sudo docker image prune -af