Skip to content

Commit

Permalink
chore: 유저 서비스 빌드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
shinseongsu committed Nov 26, 2023
1 parent 1e47079 commit 23463e1
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 5 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/user-service-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: githubAction
on:
push:
branches:
- feat/ci-cd
- develop
env:
NAME: user-service
REPO: investing-user-service
working-directory: ./user-service

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 자바 17를 설치합니다.
uses: actions/setup-java@v1
with:
java-version: 17

- name: 레디스 실행
uses: supercharge/[email protected]
with:
redis-version: '6'

- name: Gradle 명령 실행을 위한 권한을 부여합니다
run: chmod +x gradlew
working-directory: ${{ env.working-directory }}

- name: 그래들 빌드를 실행한다.
run: ./gradlew build
working-directory: ${{ env.working-directory }}

- name: 도커허브에 로그인한다.
uses: docker/login-action@v1
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}

- name: 도커 빌드
uses: docker/build-push-action@v2
with:
context: ./user-service
file: ./user-service/Dockerfile
push: true
tags: ${{secrets.DOCKERHUB_USERNAME}}/${{env.REPO}}:latest
5 changes: 5 additions & 0 deletions user-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM openjdk:17-jdk-slim

COPY build/libs/user-service-0.0.1-SNAPSHOT.jar app.jar

ENTRYPOINT ["java", "-jar", "app.jar"]
3 changes: 0 additions & 3 deletions user-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,13 @@ dependencies {
asciidoctorExtensions 'org.springframework.restdocs:spring-restdocs-asciidoctor'
}

<<<<<<< HEAD
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}

tasks.named('test') {

useJUnitPlatform()
finalizedBy 'asciidoctor'
finalizedBy 'jacocoTestReport'
Expand All @@ -80,7 +78,6 @@ asciidoctor.doFirst {
}

asciidoctor {
inputs.dir snippetsDir
configurations 'asciidoctorExtensions'
dependsOn test
}
2 changes: 1 addition & 1 deletion user-service/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ pluginManagement {
}
}

rootProject.name = 'user'
rootProject.name = 'user-service'
2 changes: 1 addition & 1 deletion user-service/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ spring:
activate:
on-profile: dev

import: optional:configserver:http://localhost:8000
import: optional:configserver:https://investing.o-r.kr
9 changes: 9 additions & 0 deletions user-service/src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
server:
port: 8080

spring:
config:
activate:
on-profile: prod

import: optional:configserver:https://investing.o-r.kr

0 comments on commit 23463e1

Please sign in to comment.