diff --git a/backend/core/Dockerfile b/backend/core/Dockerfile index 19deb965c..c8b8fedfd 100644 --- a/backend/core/Dockerfile +++ b/backend/core/Dockerfile @@ -1,29 +1,21 @@ -FROM openjdk:17-ea-slim as build +FROM eclipse-temurin:17-jre as build WORKDIR /workspace/app # Copy Gradle wrapper and other necessary files -COPY gradlew . -COPY gradle gradle -COPY build.gradle . -COPY settings.gradle . -COPY src src - -RUN apt-get update && apt-get install -y findutils - -# Execute the Gradle build -RUN ./gradlew build -x test +COPY build/libs/ . # Unpack the built application -RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../../build/libs/*.jar) +RUN mkdir -p target/extracted +RUN java -Djarmode=layertools -jar *.jar extract --destination target/extracted -FROM openjdk:17-ea-slim +FROM eclipse-temurin:17-jre VOLUME /tmp -ARG DEPENDENCY=/workspace/app/target/dependency +ARG EXTRACTED=/workspace/app/target/extracted # Copy over the unpacked application -COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /app/lib -COPY --from=build ${DEPENDENCY}/META-INF /app/META-INF -COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app +COPY --from=build ${EXTRACTED}/dependencies/ ./ +COPY --from=build ${EXTRACTED}/spring-boot-loader/ ./ +COPY --from=build ${EXTRACTED}/snapshot-dependencies/ ./ +COPY --from=build ${EXTRACTED}/application/ ./ -# Run the application -ENTRYPOINT ["java","-cp","app:app/lib/*","site.timecapsulearchive.core.CoreApplication"] +ENTRYPOINT ["java","-Dspring.profiles.active=dev","org.springframework.boot.loader.JarLauncher"] \ No newline at end of file diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/global/config/security/SecurityConfig.java b/backend/core/src/main/java/site/timecapsulearchive/core/global/config/security/SecurityConfig.java index f3b201e02..f4cc61fdb 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/global/config/security/SecurityConfig.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/global/config/security/SecurityConfig.java @@ -11,6 +11,7 @@ import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.oauth2.client.userinfo.OAuth2UserRequest; @@ -40,6 +41,11 @@ public PasswordEncoder getPasswordEncoder() { return new BCryptPasswordEncoder(); } + @Bean + public WebSecurityCustomizer webSecurityCustomizer() { + return (web) -> web.ignoring().requestMatchers("/v3/api-docs/**", "/swagger-resources/**", "/swagger-ui/**"); + } + @Bean @Order(1) public SecurityFilterChain filterChainWithOAuth(HttpSecurity http) throws Exception { @@ -77,8 +83,6 @@ public SecurityFilterChain filterChainWithJwt( http .securityMatcher(regexMatcher("^\\/(?!auth\\/login).*")) .authorizeHttpRequests(auth -> auth - .requestMatchers("/v3/api-docs/**", "/swagger-resources/**", "/swagger-ui/**") - .permitAll() .anyRequest().authenticated() ); diff --git a/backend/core/src/main/resources/config b/backend/core/src/main/resources/config index 74a21e1b5..7df8159ad 160000 --- a/backend/core/src/main/resources/config +++ b/backend/core/src/main/resources/config @@ -1 +1 @@ -Subproject commit 74a21e1b5921b7301b77a4943575bf795f624914 +Subproject commit 7df8159ad52f61a9ac87f2db6d675cc08cde0bec