:fix changed Docker image to eclipse-temurin:17 #68
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: 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@v2 | |
- name: Run chmod to make gradlew executable | |
run: chmod +x ./gradlew | |
- name: Build with Gradle | |
run: ./gradlew clean build --exclude-task test | |
- name: Login to Docker hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
## ์น ์ด๋ฏธ์ง ๋น๋ ๋ฐ ๋์ปคํ๋ธ์ push | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: sunwupark/meme-auth:latest | |
platforms: | | |
linux/amd64 | |
linux/arm64 | |
linux/arm/v7 | |
- 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 ${{ secrets.DOCKER_REPO }}/meme-auth | |
docker run -d --rm --name server -p 8080:8080 ${{ secrets.DOCKER_REPO }}/meme-auth | |
# ์ฌ์ฉํ์ง ์๋ Docker ์ด๋ฏธ์ง ์ ๋ฆฌ | |
sudo docker image prune -f |