File tree Expand file tree Collapse file tree 3 files changed +95
-0
lines changed Expand file tree Collapse file tree 3 files changed +95
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Deploy GST Beta to Server
2+
3+ on :
4+ push :
5+ branches :
6+ - beta
7+ env :
8+ APP_TAG : beta
9+ PORT : 3295
10+
11+ jobs :
12+ buildDockerImage :
13+ runs-on : ubuntu-latest
14+ name : Build/Push Docker image
15+ steps :
16+ - name : Checkout code
17+ uses : actions/checkout@v2
18+ - name : Build Docker image
19+ run : docker build -t ${{ secrets.DOCKER_USERNAME }}/gst-api:$APP_TAG .
20+ - name : Login to Docker Hub
21+ run : echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
22+ - name : Set Docker image tag
23+ run : docker tag ${{ secrets.DOCKER_USERNAME }}/gst-api:$APP_TAG ${{ secrets.DOCKER_USERNAME }}/gst-api:$APP_TAG
24+ - name : Push Docker image
25+ run : docker push ${{ secrets.DOCKER_USERNAME }}/gst-api:$APP_TAG
26+ deploy :
27+ runs-on : ubuntu-latest
28+ name : Continuous Deployment
29+ needs : [buildDockerImage]
30+ steps :
31+ - name : Deploy using ssh
32+ uses : appleboy/ssh-action@master
33+ with :
34+ host : ${{ secrets.SSH_HOST }}
35+ username : ${{ secrets.SSH_USERNAME }}
36+ key : ${{ secrets.SSH_KEY }}
37+ port : 22
38+ envs : APP_TAG, PORT
39+ script : |
40+ docker stop gst-api-$APP_TAG;
41+ docker rm gst-api-$APP_TAG;
42+ docker pull ${{ secrets.DOCKER_USERNAME }}/gst-api:$APP_TAG;
43+ docker run -d --name gst-api-$APP_TAG -p $PORT:3000 --network ${{ secrets.DOCKER_NETWORK }} --restart unless-stopped --env-file ${{ secrets.ENV_PATH }} ${{ secrets.DOCKER_USERNAME }}/gst-api:$APP_TAG;
Original file line number Diff line number Diff line change 1+ name : Deploy GST Prod to Server
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ env :
8+ APP_TAG : prod
9+ PORT : 3200
10+
11+ jobs :
12+ buildDockerImage :
13+ runs-on : ubuntu-latest
14+ name : Build/Push Docker image
15+ steps :
16+ - name : Checkout code
17+ uses : actions/checkout@v2
18+ - name : Build Docker image
19+ run : docker build -t ${{ secrets.DOCKER_USERNAME }}/gst-api:$APP_TAG .
20+ - name : Login to Docker Hub
21+ run : echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
22+ - name : Set Docker image tag
23+ run : docker tag ${{ secrets.DOCKER_USERNAME }}/gst-api:$APP_TAG ${{ secrets.DOCKER_USERNAME }}/gst-api:$APP_TAG
24+ - name : Push Docker image
25+ run : docker push ${{ secrets.DOCKER_USERNAME }}/gst-api:$APP_TAG
26+ deploy :
27+ runs-on : ubuntu-latest
28+ name : Continuous Deployment
29+ needs : [buildDockerImage]
30+ steps :
31+ - name : Deploy using ssh
32+ uses : appleboy/ssh-action@master
33+ with :
34+ host : ${{ secrets.SSH_HOST }}
35+ username : ${{ secrets.SSH_USERNAME }}
36+ key : ${{ secrets.SSH_KEY }}
37+ port : 22
38+ envs : APP_TAG, PORT
39+ script : |
40+ docker stop gst-api-$APP_TAG;
41+ docker rm gst-api-$APP_TAG;
42+ docker pull ${{ secrets.DOCKER_USERNAME }}/gst-api:$APP_TAG;
43+ docker run -d --name gst-api-$APP_TAG -p $PORT:3000 --network ${{ secrets.DOCKER_NETWORK }} --restart unless-stopped --env-file ${{ secrets.ENV_PATH }} ${{ secrets.DOCKER_USERNAME }}/gst-api:$APP_TAG;
Original file line number Diff line number Diff line change 1+ FROM --platform=linux/amd64 node:20-alpine
2+
3+ COPY . .
4+
5+ RUN yarn install
6+ RUN yarn build
7+ EXPOSE 3000
8+
9+ CMD yarn start:prod
You can’t perform that action at this time.
0 commit comments