-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (64 loc) · 2.09 KB
/
cd.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#name: Server CD
#
#on:
# push:
# branches:
# - main
#
#jobs:
# build:
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v4
#
# - name: Set up JDK 18
# uses: actions/setup-java@v4
# with:
# java-version: "18"
# distribution: "adopt"
#
# - name: Run chmod to make gradlew executable
# run: chmod +x ./gradlew
#
# - name: Add application.properties
# run: |
# mkdir -p ./src/main/resources
# touch ./src/main/resources/application.properties
# echo "${{ secrets.APPLICATION }}" > ./src/main/resources/application.properties
# cat ./src/main/resources/application.properties
#
# - name: Build with Gradle
# run: ./gradlew clean build
#
# - name: Build docker image
# run: |
# sudo chmod 666 /var/run/docker.sock
# docker buildx build --no-cache --platform linux/amd64 -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_IMAGE_NAME }}:latest -f ./Dockerfile .
#
# - name: Login to Docker Hub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
#
# - name: Publish to Docker Hub
# run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_IMAGE_NAME }}:latest
#
# - name: Connect to WAS & Execute Application
# uses: appleboy/[email protected]
# with:
# host: ${{ secrets.SERVER_HOST }}
# username: ${{ secrets.SERVER_USERNAME }}
# key: ${{ secrets.SERVER_KEY }}
# port: ${{ secrets.SERVER_PORT }}
# script: |
# sudo chmod 666 /var/run/docker.sock
# sudo chmod +x /usr/local/bin/docker-compose
# cd /home/${{ secrets.SERVER_USERNAME }}
# sudo docker-compose stop
# sudo docker-compose rm -f
# sudo docker-compose pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_IMAGE_NAME }}:latest
# docker-compose up -d
# sudo docker system prune -f
# echo "끝"