Build: Nginx 설정 추가 #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD with docker-compose | |
on: | |
push: | |
branches: ["develop-sy"] | |
permissions: | |
contents: read | |
jobs: | |
CI-CD: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: make application.yml | |
run: | | |
mkdir ./src/main/resources | |
cd ./src/main/resources | |
touch ./application.properties | |
echo "${{ secrets.PROPERTIES }}" > ./application.properties | |
shell: bash | |
- name: Build with Gradle | |
run: | | |
sudo chmod +x gradlew | |
./gradlew build | |
- name: Add .env | |
run: | | |
cd ../../../ | |
touch ./.env | |
echo "${{ secrets.DOCKER_ENV }}" > ./.env | |
- name: Deploy Images with Docker compose | |
uses: appleboy/ssh-action@master | |
env: | |
APP: "preonb" | |
with: | |
username: ubuntu | |
host: ${{ secrets.EC2_HOST }} | |
key: ${{ secrets.EC2_PRIVATE_KEY }} | |
envs: APP | |
script_stop: true | |
run: | | |
sudo docker-compose down | |
sudo docker-compose up -d | |