Skip to content

Commit

Permalink
fix : 도커파일 및 경로 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
fallkim committed May 20, 2024
1 parent 21e33d2 commit b899155
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 24 deletions.
13 changes: 7 additions & 6 deletions backend/ready/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@


FROM openjdk:17 AS builder

# 패키지를 설치해야, bootJAR 를 실행할 수 있다
RUN microdnf install findutils

COPY gradlew .
Expand All @@ -9,12 +12,10 @@ COPY settings.gradle .
COPY src src

RUN chmod +x ./gradlew
RUN ./gradlew bootJar
RUN ./gradlew bootJAR

FROM openjdk:17
WORKDIR /app

# .env 파일을 컨테이너 내에 복사
COPY .env .
FROM openjdk:17

COPY --from=builder build/libs/*.jar app.jar
# 위 builder에서 만든 .jar파일을 컨테이너 내부로 복사
COPY --from=builder build/libs/*.jar app/app.jar
Binary file not shown.
Binary file not shown.
Binary file modified backend/ready/build/tmp/compileJava/previous-compilation-data.bin
Binary file not shown.
28 changes: 10 additions & 18 deletions backend/ready/src/main/java/project/one/OneApplication.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
package project.one;

import io.github.cdimascio.dotenv.Dotenv;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.servers.Server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;

import java.util.TimeZone;

@OpenAPIDefinition(servers = {@Server(url = "/", description = "Default Server URL")})
@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
public class OneApplication {

public static void main(String[] args) {
Dotenv dotenv = Dotenv.configure()
.directory("/app/")
.filename("backend.env")
.load();
System.setProperty("spring.datasource.url", dotenv.get("SPRING_DATASOURCE_URL"));
System.setProperty("spring.datasource.password", dotenv.get("SPRING_DATASOURCE_PASSWORD"));
System.setProperty("spring.datasource.username", dotenv.get("SPRING_DATASOURCE_USERNAME"));
System.setProperty("spring.datasource.driver.class.name", dotenv.get("SPRING_DATASOURCE_DRIVER_CLASS_NAME"));
System.setProperty("spring.jpa.database", dotenv.get("SPRING_JPA_DATABASE"));
System.setProperty("s3.access.key", dotenv.get("S3_ACCESS_KEY"));
System.setProperty("s3.secret.key", dotenv.get("S3_SECRET_KEY"));
System.setProperty("s3.bucket.url", dotenv.get("S3_BUCKET_URL"));
System.setProperty("s3.bucket.name", dotenv.get("S3_BUCKET_NAME"));
System.setProperty("spring.datasource.url", System.getenv("SPRING_DATASOURCE_URL"));
System.setProperty("spring.datasource.password", System.getenv("SPRING_DATASOURCE_PASSWORD"));
System.setProperty("spring.datasource.username", System.getenv("SPRING_DATASOURCE_USERNAME"));
System.setProperty("spring.datasource.driver.class.name", System.getenv("SPRING_DATASOURCE_DRIVER_CLASS_NAME"));
System.setProperty("spring.jpa.database", System.getenv("SPRING_JPA_DATABASE"));
System.setProperty("s3.access.key", System.getenv("S3_ACCESS_KEY"));
System.setProperty("s3.secret.key", System.getenv("S3_SECRET_KEY"));
System.setProperty("s3.bucket.url", System.getenv("S3_BUCKET_URL"));
System.setProperty("s3.bucket.name", System.getenv("S3_BUCKET_NAME"));

SpringApplication.run(OneApplication.class, args);
}

}
}

0 comments on commit b899155

Please sign in to comment.