Skip to content

Commit

Permalink
Merge branch 'develop' into feat/#43
Browse files Browse the repository at this point in the history
  • Loading branch information
suakang17 authored Feb 13, 2024
2 parents f74ad60 + d3abada commit 69c98e0
Show file tree
Hide file tree
Showing 285 changed files with 6,662 additions and 1,225 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Docker Hub Push
name: Docker Hub Push for go

on:
push:
branches:
- "**/develop"
- "storage/develop"

jobs:
build-and-push:
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/dockerhub-push-nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Docker Hub Push for nodejs

on:
push:
branches:
- "music-uploader/develop"

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set Environment Variables
run: |
BRANCH_NAME=$(echo $GITHUB_REF | awk -F'/' '{print $3}')
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
- name: Build and Push Docker Image
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
BRANCH_NAME: ${{ env.BRANCH_NAME }}

run: |
if [ -n "$BRANCH_NAME" ]; then
DOCKERFILE_DIR="src/backend/$BRANCH_NAME-server"
else
echo "Failed to extract branch name from GITHUB_REF."
exit 1
fi
cd $DOCKERFILE_DIR
docker run --privileged --rm tonistiigi/binfmt --install all
docker buildx create --use
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker buildx build --platform=linux/amd64,linux/arm64 -t $DOCKER_USERNAME/$BRANCH_NAME:latest . --push
39 changes: 39 additions & 0 deletions .github/workflows/dockerhub-push-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Docker Hub Push for python

on:
push:
branches:
- "search/develop"

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set Environment Variables
run: |
BRANCH_NAME=$(echo $GITHUB_REF | awk -F'/' '{print $3}')
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
- name: Build and Push Docker Image
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
BRANCH_NAME: ${{ env.BRANCH_NAME }}

run: |
if [ -n "$BRANCH_NAME" ]; then
DOCKERFILE_DIR="src/backend/$BRANCH_NAME-server"
else
echo "Failed to extract branch name from GITHUB_REF."
exit 1
fi
cd $DOCKERFILE_DIR
docker run --privileged --rm tonistiigi/binfmt --install all
docker buildx create --use
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker buildx build --platform=linux/amd64,linux/arm64 -t $DOCKER_USERNAME/$BRANCH_NAME:latest . --push
71 changes: 71 additions & 0 deletions .github/workflows/dockerhub-push-springboot-17.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Docker Hub Push for SpringBoot 17

on:
push:
branches:
- "alarm/develop"
- "auth/develop"
- "chatting/develop"
- "feed/develop"
- "gateway/develop"
- "music/develop"
- "playlist/develop"
- "streaming/develop"
- "user/develop"

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set Environment Variables
run: |
BRANCH_NAME=$(echo $GITHUB_REF | awk -F'/' '{print $3}')
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
- name: Cache Gradle dependencies
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"

- name: Grant execute permission for gradlew
run: chmod +x src/backend/${{ env.BRANCH_NAME }}-server/gradlew

- name: Build with Gradle
run: |
cd src/backend/${{ env.BRANCH_NAME }}-server
./gradlew clean build -x test
- name: Build and Push Docker Image
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
BRANCH_NAME: ${{ env.BRANCH_NAME }}

run: |
if [ -n "$BRANCH_NAME" ]; then
DOCKERFILE_DIR="src/backend/$BRANCH_NAME-server"
else
echo "Failed to extract branch name from GITHUB_REF."
exit 1
fi
cd $DOCKERFILE_DIR
docker run --privileged --rm tonistiigi/binfmt --install all
docker buildx create --use
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker buildx build --platform=linux/amd64,linux/arm64 -t $DOCKER_USERNAME/$BRANCH_NAME:latest . --push
63 changes: 63 additions & 0 deletions .github/workflows/dockerhub-push-springboot-21.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Docker Hub Push for SpringBoot 21

on:
push:
branches:
- "chart/develop"

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set Environment Variables
run: |
BRANCH_NAME=$(echo $GITHUB_REF | awk -F'/' '{print $3}')
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
- name: Cache Gradle dependencies
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: "21"
distribution: "temurin"

- name: Grant execute permission for gradlew
run: chmod +x src/backend/${{ env.BRANCH_NAME }}-server/gradlew

- name: Build with Gradle
run: |
cd src/backend/${{ env.BRANCH_NAME }}-server
./gradlew clean build -x test
- name: Build and Push Docker Image
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
BRANCH_NAME: ${{ env.BRANCH_NAME }}

run: |
if [ -n "$BRANCH_NAME" ]; then
DOCKERFILE_DIR="src/backend/$BRANCH_NAME-server"
else
echo "Failed to extract branch name from GITHUB_REF."
exit 1
fi
cd $DOCKERFILE_DIR
docker run --privileged --rm tonistiigi/binfmt --install all
docker buildx create --use
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker buildx build --platform=linux/amd64,linux/arm64 -t $DOCKER_USERNAME/$BRANCH_NAME:latest . --push
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

37 changes: 37 additions & 0 deletions src/backend/alarm-server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
README.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
25 changes: 25 additions & 0 deletions src/backend/alarm-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Build - https://findstar.pe.kr/2022/05/13/gradle-docker-cache/
FROM gradle:8.6.0-jdk17 as builder
WORKDIR /build

# 그레이들 파일이 변경되었을 때만 새로운 의존성 다운로드
COPY build.gradle settings.gradle /build/
COPY alarm-api/build.gradle /build/alarm-api/
RUN gradle build -x test --parallel --continue > /dev/null 2>&1 || true

# 빌더 이미지에서 애플리케이션 빌드
COPY . /build
RUN gradle build -x test --parallel

# Run
FROM openjdk:17-jdk-slim
WORKDIR /app

COPY --from=builder /build/alarm-api/build/libs/*.jar app.jar

ARG DOCKER_YML_FILE=src/main/resources/application.yml
COPY ${DOCKER_YML_FILE} application.yml

EXPOSE 28000

ENTRYPOINT ["java", "-jar", "app.jar"]
25 changes: 25 additions & 0 deletions src/backend/alarm-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Getting Started

### Reference Documentation
For further reference, please consider the following sections:

* [Official Gradle documentation](https://docs.gradle.org)
* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.2.1/gradle-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.2.1/gradle-plugin/reference/html/#build-image)
* [Spring Web](https://docs.spring.io/spring-boot/docs/3.2.1/reference/htmlsingle/index.html#web)
* [Spring Data JPA](https://docs.spring.io/spring-boot/docs/3.2.1/reference/htmlsingle/index.html#data.sql.jpa-and-spring-data)

### Guides
The following guides illustrate how to use some features concretely:

* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)
* [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/)
* [Accessing data with MySQL](https://spring.io/guides/gs/accessing-data-mysql/)

### Additional Links
These additional references should also help you:

* [Gradle Build Scans – insights for your project's build](https://scans.gradle.com#gradle)

13 changes: 13 additions & 0 deletions src/backend/alarm-server/alarm-api/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
bootJar {
enabled = true
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.mysql:mysql-connector-j'

implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'

implementation 'org.springframework.kafka:spring-kafka'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.lalala.alarm;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class AlarmApplication {

public static void main(String[] args) {
SpringApplication.run(AlarmApplication.class, args);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.lalala.alarm.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

@Configuration
@EnableJpaAuditing
public class JpaAuditingConfiguration {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.lalala.alarm.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SwaggerConfiguration {
@Bean
public OpenAPI openAPI() {
return new OpenAPI()
.info(new Info()
.title("알람 API")
.description("알람 API를 제공합니다.")
.version("0.0.1")
);
}
}
Loading

0 comments on commit 69c98e0

Please sign in to comment.