Skip to content

Commit

Permalink
fix: #1 conflict해결
Browse files Browse the repository at this point in the history
  • Loading branch information
SunYerim committed Jun 16, 2024
1 parent 068a7e8 commit b8597a7
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 3 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Auth CI/CD

on:
push:
branches: [ main ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Clear Gradle cache
run: rm -rf ~/.gradle/caches/

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build --no-daemon

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/sunjoo:auth .
docker push ${{ secrets.DOCKER_USERNAME }}/sunjoo:auth
- name: SSH and Deploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
docker pull ${{ secrets.DOCKER_USERNAME }}/sunjoo:auth
if [ "$(docker ps -aq -f name=sunjoo-server-auth)" ]; then
docker stop sunjoo-server-auth
docker rm sunjoo-server-auth
fi
docker run -d -p 8080:8090 --name sunjoo-server-auth ${{ secrets.DOCKER_USERNAME }}/sunjoo:auth
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
FROM openjdk:17
CMD ["./gradlew", "clean", "build"]
ARG JAR_FILE_PATH=build/libs/*.jar
COPY ${JAR_FILE_PATH} app.jar
COPY build/libs/*.jar app.jar
ENTRYPOINT ["java", "-jar", "app.jar"]
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3.8'
services:
auth:
image: sunyerim/sunjoo:auth
container_name: sunjoo-server-auth
restart: always
# depends_on:
# - redis
ports:
- "8080:8090"

0 comments on commit b8597a7

Please sign in to comment.