Skip to content

Commit

Permalink
Merge pull request #8 from UMC-HACKATHON-SnapSpot/feat#/5
Browse files Browse the repository at this point in the history
feat: 도커 세팅
  • Loading branch information
m3k0813 authored Jul 4, 2024
2 parents 5ebd23e + 01d72c1 commit 5871a0f
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,6 @@ gradle-app.setting
# Java heap dump
*.hprof

# End of https://www.toptal.com/developers/gitignore/api/java,intellij+all,gradle
# End of https://www.toptal.com/developers/gitignore/api/java,intellij+all,gradle

.env
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM openjdk:17-jdk
ARG JAR_FILE=build/libs/*.jar
COPY ${JAR_FILE} snapspot-0.0.1-SNAPSHOT.jar
ENTRYPOINT ["java","-jar","/snapspot-0.0.1-SNAPSHOT.jar"]
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '3'
services:
spot:
image: 2hy2on/spot
container_name: spot_container
restart: always
build:
context: ./
dockerfile: Dockerfile
ports:
- "8080:8080"
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://mysql_db:3306/${MYSQL_DATABASE}?useSSL=false&allowPublicKeyRetrieval=true
SPRING_DATASOURCE_USERNAME: ${MYSQL_USER}
SPRING_DATASOURCE_PASSWORD: ${MYSQL_PASSWORD}
networks:
- team_network

networks:
team_network:
13 changes: 13 additions & 0 deletions src/main/java/com/umc/hackaton/snapspot/hello/HelloController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.umc.hackaton.snapspot.hello;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

@GetMapping("/hello")
public String hello(){
return "Hello, World!";
}
}
1 change: 0 additions & 1 deletion src/main/resources/application.properties

This file was deleted.

15 changes: 15 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/${MYSQL_LOCAL_DATABASE}?useSSL=false&allowPublicKeyRetrieval=true
username: ${MYSQL_USER}
password: ${MYSQL_PASSWORD}

jpa:
hibernate:
ddl-auto: create
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
show-sql: true
properties:
hibernate.dialect: org.hibernate.dialect.MySQL8Dialect

0 comments on commit 5871a0f

Please sign in to comment.