diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml new file mode 100644 index 00000000..05ae9efe --- /dev/null +++ b/.github/workflows/bump-version.yml @@ -0,0 +1,12 @@ +name: release +on: + pull_request: + types: + - labeled + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: haya14busa/action-bumpr@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cac4337a..fb9c9916 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,13 +3,52 @@ on: push: branches: - main - pull_request: - types: - - labeled + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} jobs: release: runs-on: ubuntu-latest + outputs: + next_version: ${{ steps.bump.outputs.next_version }} steps: - uses: actions/checkout@v4 - uses: haya14busa/action-bumpr@v1 + id: bump + + package: + runs-on: ubuntu-latest + needs: release + + permissions: + contents: read + packages: write + attestations: write + id-token: write + + steps: + - uses: actions/checkout@v4 + + - uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + + - uses: docker/metadata-action@v5 + id: meta + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=latest + type=raw,value=${{ needs.release.outputs.next_version }} + + - uses: docker/build-push-action@v6 + with: + context: ./backend + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 00000000..9d6c0759 --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,9 @@ +FROM gradle:jdk21 AS builder +WORKDIR /app +COPY . . +RUN ./gradlew clean build -x test + +FROM openjdk:21-slim +WORKDIR /app +COPY --from=builder /app/build/libs/*.jar app.jar +ENTRYPOINT ["java", "-jar", "app.jar"] \ No newline at end of file diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml index bed10bcd..4fe7ef60 100644 --- a/backend/src/main/resources/application.yml +++ b/backend/src/main/resources/application.yml @@ -12,10 +12,11 @@ spring: username: ${DB_USERNAME} password: ${DB_PASSWORD} - data: - redis: - host: ${REDIS_HOST} - port: ${REDIS_PORT} +# Redis 도입 시 정의 +# data: +# redis: +# host: ${REDIS_HOST} +# port: ${REDIS_PORT} jpa: defer-datasource-initialization: true # 현재는 data.sql 에서 더미 유저 자동 추가를 위해 넣어뒀음.