Compare commits

...

6 Commits

Author SHA1 Message Date
bf7f7a572b Changes sort default to descending
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
2025-12-01 13:17:03 -06:00
daafa2f905 Updates dependencies and Gradle 2025-12-01 13:14:30 -06:00
6c6abcf8d7 Adds more CORS config
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/manual/woodpecker Pipeline was successful
2025-09-30 00:37:03 -05:00
2e4bbbd810 Removes breaking and unneeded config annotation
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2025-09-30 00:20:26 -05:00
8a8a8f15b1 Updates CORS for non-localhost access
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-09-29 23:21:38 -05:00
7ae491da43 Adds Docker file and Woodpecker integration
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
2025-02-19 09:28:32 -06:00
8 changed files with 72 additions and 9 deletions

15
.woodpecker.yaml Normal file
View File

@@ -0,0 +1,15 @@
when:
branch: main
event:
- push
- manual
steps:
- name: build
image: woodpeckerci/plugin-docker-buildx
settings:
repo: git.halfbinary.net/${CI_REPO_OWNER}/tmnt-api
registry: git.halfbinary.net
tags: ${CI_PIPELINE_NUMBER}
username: ${CI_REPO_OWNER}
password:
from_secret: docker_password

27
Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
FROM amazoncorretto:21-alpine-jdk as build
LABEL maintainer="Alex Arbit <aarbit@gmail.com>"
WORKDIR /app
COPY build.gradle.kts .
COPY gradlew .
COPY gradlew.bat .
COPY settings.gradle.kts .
COPY gradle ./gradle
COPY src ./src
RUN apk --no-cache add gradle
RUN gradle bootJar
RUN ls -al
RUN ls -al /
FROM amazoncorretto:21-alpine-jdk
COPY --from=build /app/build/libs/*.jar app.jar
RUN ls -al
EXPOSE 8080
ENTRYPOINT ["java","-jar","app.jar"]

View File

@@ -1,9 +1,9 @@
plugins {
kotlin("jvm") version "1.9.25"
kotlin("plugin.spring") version "1.9.25"
id("org.springframework.boot") version "3.4.2"
kotlin("jvm") version "2.2.21"
kotlin("plugin.spring") version "2.2.21"
id("org.springframework.boot") version "4.0.0"
id("io.spring.dependency-management") version "1.1.7"
kotlin("plugin.jpa") version "1.9.25"
kotlin("plugin.jpa") version "2.2.21"
}
group = "net.halfbinary"
@@ -20,7 +20,7 @@ repositories {
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web:3.4.2")
implementation("org.springframework.boot:spring-boot-starter-web:4.0.0")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("com.mysql:mysql-connector-j:9.2.0")
implementation("org.jetbrains.kotlin:kotlin-reflect")

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

View File

@@ -0,0 +1,22 @@
package net.halfbinary.tmnt.config
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.web.servlet.config.annotation.CorsRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
@Configuration(proxyBeanMethods = false)
class MyCorsConfiguration {
@Bean
fun corsConfigurer(): WebMvcConfigurer {
return object : WebMvcConfigurer {
override fun addCorsMappings(registry: CorsRegistry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("GET")
}
}
}
}

View File

@@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/movies")
@CrossOrigin(origins = ["http://localhost:5173"])
class MoviesController(val moviesService: MoviesService) {
@GetMapping
fun getAllMovies(): List<MovieResponse> {

View File

@@ -8,7 +8,7 @@ import org.springframework.stereotype.Service
@Service
class MoviesService(val moviesRepository: MoviesRepository) {
fun getAllMovies(): List<Movie> {
return moviesRepository.findAll().map { it.toModel()}
return moviesRepository.findAll().map { it.toModel()}.sortedByDescending { it.screenedDate }
}
fun createNewMovie(newMovie: Movie) {

View File

@@ -1,7 +1,7 @@
spring.application.name=tmnt
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://192.168.187.129:3307/tmnt
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
#spring.jpa.database-platform=org.hibernate.dialect.mysql
spring.datasource.username=tmntdb
spring.datasource.password=1mstr.SPLNTR