-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (47 loc) Β· 1.8 KB
/
gradle.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
name: Deploy Production Server
on:
push:
branches: [ "prod" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
## gradle build
- name: Build with Gradle
run: ./gradlew bootJar
## μΉ μ΄λ―Έμ§ λΉλ λ° λ컀νλΈμ push
- name: web docker build and push
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_REPO }}/repick-web .
docker push ${{ secrets.DOCKER_REPO }}/repick-web
docker build -f dockerfile-nginx -t ${{ secrets.DOCKER_REPO }}/repick-nginx .
docker push ${{ secrets.DOCKER_REPO }}/repick-nginx
## docker compose up
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.KEY }}
script: |
cd /home/ubuntu/repick/
sudo touch .env
echo "${{ secrets.ENV_VARS }}" | sudo tee .env > /dev/null
sudo touch docker-compose.yaml
echo "${{ vars.DOCKER_COMPOSE }}" | sudo tee docker-compose.yaml > /dev/null
sudo chmod 666 /var/run/docker.sock
sudo docker rm -f $(docker ps -qa)
sudo docker pull ${{ secrets.DOCKER_REPO }}/repick-web
sudo docker pull ${{ secrets.DOCKER_REPO }}/repick-nginx
docker-compose -f docker-compose.yaml --env-file /home/ubuntu/repick/.env up -d
docker image prune -f