-
Notifications
You must be signed in to change notification settings - Fork 1
41 lines (35 loc) · 1.41 KB
/
github-actions.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Deploy Next.js with Docker
on:
push:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Docker Login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker build and Push
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/meetfolio-web:latest .
docker push ${{secrets.DOCKER_USERNAME}}/meetfolio-web:latest
- name: Deploy in GCP
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.GCE_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
echo "NEXT_PUBLIC_SERVER=${{ secrets.NEXT_PUBLIC_SERVER }}" > .env.local
echo "NEXT_PUBLIC_NEXT_SERVER=${{ secrets.NEXT_PUBLIC_NEXT_SERVER }}" >> .env.local
echo "TZ=Asia/Seoul" >> .env.local
cat .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 --env-file .env.local -e PORT=60005 -p 60005:60005 meetfolio-web:latest
docker image prune -af