-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
160 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
HELP.md | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
before.json | ||
after.json | ||
.gradle | ||
.mvn | ||
|
||
**/resources/*.properties | ||
!**/resources/application.properties |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Automated CI | ||
on: | ||
push: | ||
branches: ["*"] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
env: | ||
IMAGE_NAME: umi0410/khumu-community | ||
steps: | ||
- name: 배포 환경 설정 | ||
run: | | ||
# master 혹은 main 브랜치의 경우 prd 환경에 배포합니다. | ||
# 그 외의 브랜치는 dev로 | ||
environment="dev" | ||
if [ ${GITHUB_REF#refs/heads/} == "master" ]; then | ||
environment="prd" | ||
elif [ ${GITHUB_REF#refs/heads/} == "main" ]; then | ||
environment="prd" | ||
fi | ||
echo "현재 ref: ${GITHUB_REF#refs/heads/}" | ||
echo "설정된 배포 환경 ${environment}" | ||
echo "environment=${environment}" >> $GITHUB_ENV | ||
- name: 🛎️ Checkout | ||
uses: actions/[email protected] # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly. | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
submodules: true | ||
|
||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 11 | ||
|
||
- name: 🍦 Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: 🏗️ Build images | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: false # buildkit을 쓰면 auto push가 안되는듯? | ||
tags: | | ||
${{ env.IMAGE_NAME }}:latest | ||
${{ env.IMAGE_NAME }}:${{ github.run_id }} | ||
- name: 🏗️ Push images | ||
run: | | ||
docker push ${{ env.IMAGE_NAME }}:latest | ||
docker push ${{ env.IMAGE_NAME }}:${{ github.run_id }} | ||
- name: Setup Kustomize | ||
uses: imranismail/setup-kustomize@v1 | ||
with: | ||
kustomize-version: "3.8.6" | ||
|
||
- name: 🛎 Clone the devops repository | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: khu-dev/khumu-devops | ||
token: ${{ secrets.PUSH_TO_OTHER_REPO }} | ||
path: 'khumu-devops' | ||
|
||
- name: Edit Kustomization.yaml | ||
working-directory: khumu-devops/khumu-community/${{ env.environment }} | ||
run: | | ||
kustomize version | ||
kustomize edit set image ${{ env.IMAGE_NAME }}=${{ env.IMAGE_NAME }}:${{ github.run_id }} | ||
- name: Push to another repository | ||
uses: cpina/github-action-push-to-another-repository@master | ||
env: | ||
API_TOKEN_GITHUB: ${{ secrets.PUSH_TO_OTHER_REPO }} | ||
with: | ||
source-directory: khumu-devops | ||
destination-github-username: 'khu-dev' | ||
destination-repository-name: 'khumu-devops' | ||
|
||
- name: 슬랙 알림 | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: ${{ job.status }} | ||
author_name: Github Action # default: 8398a7@action-slack | ||
# fields: repo,message,commit,author,action,eventName,ref,workflow,job,took | ||
fields: repo,message,commit,author,ref,took | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required | ||
if: always() # Pick up events even if the job fails or is canceled. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM openjdk:11-jdk-slim as build | ||
WORKDIR /khumu | ||
|
||
COPY gradle gradle | ||
COPY build.gradle gradlew gradlew.bat ./ | ||
COPY src src | ||
|
||
RUN ./gradlew build -x test | ||
|
||
FROM openjdk:11-jre-slim | ||
WORKDIR /khumu | ||
COPY --from=build /khumu/src/main/resources resources | ||
COPY --from=build /khumu/build/libs/*.jar community.jar | ||
# java -Dspring.profiles.active=dev -jar community.jar --spring.config.location=resources/ | ||
ENTRYPOINT ["java", "-Dspring.profiles.active=dev", "-jar", "community.jar", "--spring.config.location=resources/"] |
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
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