Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Commit

Permalink
[WEAV-21] ✨ 개발서버 CI workflow 구현 (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
waterfogSW authored Jan 23, 2024
1 parent 241748a commit b86df56
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 4 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/ci_dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI - Dev

on:
push:
branches:
- main

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Check Out Repository
uses: actions/checkout@v2

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Login to Amazon ECR Public
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public

- name: Build, tag, and push docker image to Amazon ECR Public
env:
REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
REGISTRY_ALIAS: h3l4i6v1
REPOSITORY: weave_server_dev_cr
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -f Dockerfile-http -t $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG .
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
- name: Logout of Amazon ECR
run: docker logout ${{ env.ECR_REGISTRY }}
11 changes: 11 additions & 0 deletions Dockerfile-http
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Build stage
FROM gradle:jdk17 AS build
COPY --chown=gradle:gradle . /home/gradle/src
WORKDIR /home/gradle/src
RUN gradle :bootstrap:http:bootJar --no-daemon

# Package stage
FROM openjdk:17
COPY --from=build /home/gradle/src/bootstrap/http/build/libs/http-*.jar /app.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","/app.jar"]
13 changes: 11 additions & 2 deletions bootstrap/http/compose-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
version: '3.8'
services:
spring:
image: public.ecr.aws/h3l4i6v1/weave_server_dev_cr
environment:
SPRING_PROFILES_ACTIVE: dev
DB_URL: jdbc:mysql://mysql/weave?serverTimezone=Asia/Seoul&characterEncoding=UTF-8&allowPublicKeyRetrieval=true
DB_USERNAME: root
DB_PASSWORD: secret
depends_on:
- mysql
mysql:
image: mysql:8.0.33
environment:
- "MYSQL_DATABASE=user"
- "MYSQL_ROOT_PASSWORD=secret"
MYSQL_DATABASE: weave
MYSQL_ROOT_PASSWORD: secret
ports:
- "3306:3306"
9 changes: 9 additions & 0 deletions bootstrap/http/compose-local.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '3.8'
services:
mysql:
image: mysql:8.0.33
environment:
MYSQL_DATABASE: weave
MYSQL_ROOT_PASSWORD: secret
ports:
- "3306:3306"
4 changes: 2 additions & 2 deletions bootstrap/http/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spring:
on-profile: local
docker:
compose:
file: ./bootstrap/http/compose-dev.yaml
file: ./bootstrap/http/compose-local.yaml
springdoc:
swagger-ui:
enabled: true
Expand All @@ -27,7 +27,7 @@ spring:
on-profile: dev
docker:
compose:
file: ./bootstrap/http/compose-dev.yaml
enabled: false
springdoc:
swagger-ui:
enabled: true
Expand Down
3 changes: 3 additions & 0 deletions buildSrc/src/main/kotlin/Version.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ object Version {

const val JACKSON = "2.16.1"
const val SPRINGDOC_OPENAPI = "2.3.0"

const val MYSQL = "8.0.33"
const val H2 = "2.2.224"
}
4 changes: 4 additions & 0 deletions infrastructure/persistence/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ jar.enabled = true
dependencies {
implementation(project(":domain"))
implementation(project(":application"))

implementation("org.springframework.boot:spring-boot-starter-data-jpa:${Version.SPRING_BOOT}")
runtimeOnly("mysql:mysql-connector-java:${Version.MYSQL}")
testRuntimeOnly("com.h2database:h2:${Version.H2}")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ${DB_URL:jdbc:mysql://localhost:3306/weave?serverTimezone=Asia/Seoul&characterEncoding=UTF-8}
username: ${DB_USERNAME:root}
password: ${DB_PASSWORD:secret}
jpa:
open-in-view: false
hibernate:
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
properties:
hibernate.format_sql: true
dialect: org.hibernate.dialect.MySQL8InnoDBDialect
---
spring:
config:
activate:
on-profile: local
jpa:
hibernate:
ddl-auto: validate
show-sql: true
---
spring:
config:
activate:
on-profile: dev
jpa:
hibernate:
ddl-auto: validate
show-sql: true

0 comments on commit b86df56

Please sign in to comment.