Skip to content

Commit

Permalink
Merge pull request #19 from goormthon-Univ/dev
Browse files Browse the repository at this point in the history
!Hotfix: 서브 모듈로 변경
  • Loading branch information
JeongHeumChoi authored Mar 14, 2024
2 parents 30718ff + e10d00c commit d1d82f1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 36 deletions.
51 changes: 17 additions & 34 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,43 @@
name: Java CI with Gradle
name: deploy-actions

on:
push:
branches: [ "prod" ]

jobs:
build:
runs-on: ubuntu-22.04
permissions:
contents: read
ci:
runs-on: ubuntu-20.04

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

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

- name: Create Secret Config file
run: |
cd src/main/resources
echo "${{ secrets.APPLICATION_PROD }}" > ./application-prod.yml
ls -l ./application-prod.yml
cat ./application-prod.yml
- name: Setup Gradle
uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0

- name: Build with Gradle Wrapper
run: ./gradlew build -x test
token: ${{ secrets.GIT_TOKEN }}
submodules: true

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Login to DockerHub
uses: docker/[email protected]
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_PROD_REPONAME }}:0.0.1
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:0.0.1

deploy:
needs: [build]
runs-on: ubuntu-22.04
cd:
needs: [ci]
runs-on: ubuntu-20.04

steps:
- name: Docker Image Pull and Container Run
- name: Docker Image Pull And Container Run
uses: appleboy/[email protected]
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "startup-valley-properties"]
path = startup-valley-properties
url = https://github.com/JeongHeumChoi/startup-valley-properties.git
branch = main
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ RUN ./gradlew clean build -x test

FROM openjdk:17-jdk-alpine
COPY --from=builder /usr/src/build/libs/startup_valley-0.0.1-SNAPSHOT.jar /usr/app/app.jar
COPY src/main/resources/application-prod.yml /usr/app/config/application-prod.yml
ENTRYPOINT ["java", "-jar", "/usr/app/app.jar", "--spring.config.location=file:/usr/app/config/application-prod.yml"]
ENTRYPOINT ["java", "-jar", "/usr/app/app.jar", "--spring.profiles.active=prod"]
8 changes: 8 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ dependencies {
testImplementation 'org.springframework.security:spring-security-test'
}

task copyGitSubmodule(type: Copy) {
copy {
from './startup-valley-properties'
include '*.yml'
into './src/main/resources'
}
}

tasks.named('test') {
useJUnitPlatform()
}

0 comments on commit d1d82f1

Please sign in to comment.