Compare commits
6 Commits
32f29b4795
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| bf7f7a572b | |||
| daafa2f905 | |||
| 6c6abcf8d7 | |||
| 2e4bbbd810 | |||
| 8a8a8f15b1 | |||
| 7ae491da43 |
15
.woodpecker.yaml
Normal file
15
.woodpecker.yaml
Normal 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
27
Dockerfile
Normal 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"]
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "1.9.25"
|
kotlin("jvm") version "2.2.21"
|
||||||
kotlin("plugin.spring") version "1.9.25"
|
kotlin("plugin.spring") version "2.2.21"
|
||||||
id("org.springframework.boot") version "3.4.2"
|
id("org.springframework.boot") version "4.0.0"
|
||||||
id("io.spring.dependency-management") version "1.1.7"
|
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"
|
group = "net.halfbinary"
|
||||||
@@ -20,7 +20,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
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("org.springframework.boot:spring-boot-starter-data-jpa")
|
||||||
implementation("com.mysql:mysql-connector-j:9.2.0")
|
implementation("com.mysql:mysql-connector-j:9.2.0")
|
||||||
implementation("org.jetbrains.kotlin:kotlin-reflect")
|
implementation("org.jetbrains.kotlin:kotlin-reflect")
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
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
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
22
src/main/kotlin/net/halfbinary/tmnt/config/WebConfig.kt
Normal file
22
src/main/kotlin/net/halfbinary/tmnt/config/WebConfig.kt
Normal 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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.RestController
|
|||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/movies")
|
@RequestMapping("/movies")
|
||||||
@CrossOrigin(origins = ["http://localhost:5173"])
|
|
||||||
class MoviesController(val moviesService: MoviesService) {
|
class MoviesController(val moviesService: MoviesService) {
|
||||||
@GetMapping
|
@GetMapping
|
||||||
fun getAllMovies(): List<MovieResponse> {
|
fun getAllMovies(): List<MovieResponse> {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import org.springframework.stereotype.Service
|
|||||||
@Service
|
@Service
|
||||||
class MoviesService(val moviesRepository: MoviesRepository) {
|
class MoviesService(val moviesRepository: MoviesRepository) {
|
||||||
fun getAllMovies(): List<Movie> {
|
fun getAllMovies(): List<Movie> {
|
||||||
return moviesRepository.findAll().map { it.toModel()}
|
return moviesRepository.findAll().map { it.toModel()}.sortedByDescending { it.screenedDate }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createNewMovie(newMovie: Movie) {
|
fun createNewMovie(newMovie: Movie) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
spring.application.name=tmnt
|
spring.application.name=tmnt
|
||||||
spring.jpa.hibernate.ddl-auto=update
|
spring.jpa.hibernate.ddl-auto=update
|
||||||
spring.datasource.url=jdbc:mysql://192.168.187.129:3307/tmnt
|
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.jpa.database-platform=org.hibernate.dialect.mysql
|
||||||
spring.datasource.username=tmntdb
|
spring.datasource.username=tmntdb
|
||||||
spring.datasource.password=1mstr.SPLNTR
|
spring.datasource.password=1mstr.SPLNTR
|
||||||
Reference in New Issue
Block a user