feat : add kafka #16
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: Build And Deploy with Docker | |
on: | |
push: | |
paths-ignore: | |
- 'README.md' | |
branches: [ develop ] | |
env: | |
DOCKER_IMAGE: ghcr.io/jiwonkkang/tracedin | |
VERSION: ${{ github.sha }} | |
CONTAINER_NAME: tracedin | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 # git 레파지토리를 클론하는것과 같음 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup docker buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Cache docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ env.VERSION }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Login to ghcr | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GHCR_ACTOR }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 | |
- name: Build with Gradle | |
run: ./gradlew clean build -x test | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
file: ./tracedin-application/app-api/Dockerfile | |
context: . | |
builder: ${{ steps.buildx.outputs.name }} | |
push: true | |
tags: ${{ env.DOCKER_IMAGE }}:latest | |
deploy: | |
needs: build | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Docker login | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.REMOTE_IP }} | |
username: ${{ secrets.REMOTE_SSH_ID }} | |
key: ${{ secrets.REMOTE_SSH_KEY }} | |
port: ${{ secrets.REMOTE_SSH_PORT }} | |
script: | | |
sudo chmod 666 /var/run/docker.sock | |
echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Run | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.REMOTE_IP }} | |
username: ${{ secrets.REMOTE_SSH_ID }} | |
key: ${{ secrets.REMOTE_SSH_KEY }} | |
port: ${{ secrets.REMOTE_SSH_PORT }} | |
script: | | |
./deploy.sh |