Docker compose almost working

This commit is contained in:
Laurent
2024-10-23 23:01:11 +02:00
parent a66035d1f5
commit e6a6bf274b
57 changed files with 906 additions and 169 deletions

25
back/Dockerfile Normal file
View File

@@ -0,0 +1,25 @@
# temp container to build using gradle
FROM gradle:8.10.2-jdk21 AS TEMP_BUILD_IMAGE
ENV APP_HOME=/usr/app/
WORKDIR $APP_HOME
COPY build.gradle settings.gradle $APP_HOME
COPY gradle $APP_HOME/gradle
COPY --chown=gradle:gradle . /home/gradle/src
USER root
RUN chown -R gradle /home/gradle/src
RUN gradle build || return 0
COPY . .
RUN gradle clean build
# actual container
FROM eclipse-temurin:21-jdk
ENV ARTIFACT_NAME=unluckiest-1.0.0.jar
ENV APP_HOME=/usr/app/
WORKDIR $APP_HOME
COPY --from=TEMP_BUILD_IMAGE $APP_HOME/build/libs/$ARTIFACT_NAME .
EXPOSE 8000
ENTRYPOINT exec java -jar ${ARTIFACT_NAME}

View File

@@ -5,7 +5,7 @@ plugins {
}
springBoot {
mainClass = 'be.naaturel.homestorage.HomeStorageApplication'
mainClass = 'be.naaturel.unluckiest.UnluckiestApplication'
}
group = 'be.naaturel'

View File

@@ -50,7 +50,6 @@ public class Security {
config.setAllowedOrigins(Arrays.asList(conf.authorizedHosts));
config.setAllowedMethods(Arrays.asList(conf.authorizedMethods));
config.setAllowedHeaders(Arrays.asList(conf.authorizedHeaders));
config.setAllowCredentials(true);
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", config);

View File

@@ -12,7 +12,7 @@ public interface ScoreRepo
extends JpaRepository<ScoreEntity, String> {
@Query(
value = "SELECT * FROM Score s HAVING 10;",
value = "SELECT * FROM score s HAVING 10;",
nativeQuery = true)
List<ScoreEntity> findLeaderboard();

View File

@@ -1,15 +1,18 @@
#=============MAIN=============
spring.application.name=unluckiest
#=============SERVER=============
server.port=5000
#=============SECURITY=============
sec.cors.authorizedHots=http://localhost:5173
sec.cors.authorizedHots=*
sec.cors.authorizedMethods=GET,POST,PUT,DELETE,OPTION
sec.cors.authorizedHeader=Authorization,Content-type
#=============DATABASE=============
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/unluckiest_db
spring.datasource.username=root
spring.datasource.password=
spring.datasource.url=jdbc:${DB_URL}
spring.datasource.username=${DB_USER}
spring.datasource.password=${DB_PASSWORD}
spring.jpa.database-platform=org.hibernate.dialect.MariaDBDialect
spring.jpa.show-sql=true

View File

@@ -6,8 +6,4 @@ import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class UnluckiestApplicationTests {
@Test
void contextLoads() {
}
}