Skip to content

Merge pull request #23 from Happy-New-Here/feature-#22 #20

Merge pull request #23 from Happy-New-Here/feature-#22

Merge pull request #23 from Happy-New-Here/feature-#22 #20

Workflow file for this run

name: Docker Image CI
on:
push:
branches: ["develop"]
jobs:
CI-CD:
runs-on: ubuntu-latest
timeout-minutes: 360
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Add env properties
run: |
touch ./src/main/resources/env.yml
echo "${{ secrets.ENV_YML }}" > ./src/main/resources/env.yml
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}
- name: Build with Gradle
run: ./gradlew build -x test
- name: Docker build & push
if: contains(github.ref, 'develop')
run: |
docker login -u yooonwodyd00 -p ${{ secrets.DOCKER_PASSWORD }}
docker build -f Dockerfile -t yooonwodyd00/happynewhere_be-app .
docker push yooonwodyd00/happynewhere_be-app
## deploy to develop
- name: Deploy to dev
if: contains(github.ref, 'develop')
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_IP }}
username: ${{ secrets.REMOTE_SSH_ID }}
password: ${{ secrets.REMOTE_SSH_KEY }}
port: ${{ secrets.REMOTE_SSH_PORT }}
command_timeout: 200m
script: |
sudo docker ps
sudo docker pull yooonwodyd00/happynewhere_be-app
sudo docker compose down
sudo docker compose up -d