Skip to content

Merge branch 'develop' of https://github.com/MEME-UMC/MEME_AUTH into โ€ฆ #37

Merge branch 'develop' of https://github.com/MEME-UMC/MEME_AUTH into โ€ฆ

Merge branch 'develop' of https://github.com/MEME-UMC/MEME_AUTH into โ€ฆ #37

Workflow file for this run

name: main Workflow
on:
push:
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Set .yml for main
run: |
mkdir -p src/main/resources
echo "${{ secrets.MAIN_DATABASE_YML }}" | base64 --decode > src/main/resources/application.yml
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Run chmod to make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew clean build --exclude-task test
## ์›น ์ด๋ฏธ์ง€ ๋นŒ๋“œ ๋ฐ ๋„์ปคํ—ˆ๋ธŒ์— push
- name: web docker build and push
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_REPO }}/meme-auth .
docker push ${{ secrets.DOCKER_REPO }}/meme-auth
- name: EC2 docker permission
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.KEY }}
script: |
sudo chmod 666 /var/run/docker.sock
- name: EC2 docker remove
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.KEY }}
script: |
if [ "$(sudo docker ps -aq)" ]; then
sudo docker stop $(sudo docker ps -aq)
sudo docker rm -f $(sudo docker ps -aq)
fi
if [ "$(sudo docker images -aq)" ]; then
sudo docker rmi -f $(sudo docker images -aq)
fi
- name: Docker Run on EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.KEY }}
script: |
# Docker ์ด๋ฏธ์ง€ ๋‹ค์šด๋กœ๋“œ
sudo docker pull sunwupark/meme-auth
docker run -d --rm --name server -p 8080:8080 sunwupark/meme-auth
# ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” Docker ์ด๋ฏธ์ง€ ์ •๋ฆฌ
sudo docker image prune -f