🐳 Adds dockerfile

This commit is contained in:
Daniel Svitan
2025-05-18 12:28:37 +02:00
parent d1ddd7be3b
commit c124754c96
7 changed files with 110 additions and 10 deletions

57
backend/.dockerignore Normal file
View File

@@ -0,0 +1,57 @@
### Gradle template
.gradle
**/build/
!src/**/build/
# Ignore Gradle GUI config
gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties
# Cache of project
.gradletasknamecache
# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
### Kotlin template
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
### Custom
.idea/
.kotlin/
data/
compose.yaml
src/main/resources/.env

8
backend/Dockerfile Normal file
View File

@@ -0,0 +1,8 @@
FROM gradle:jdk17
WORKDIR /app
COPY --chown=gradle:gradle . .
RUN gradle buildFatJar
CMD ["gradle", "runFatJar"]

View File

@@ -23,7 +23,9 @@ fun main() {
}
fun Application.module() {
val dotenv = dotenv()
val dotenv = dotenv {
ignoreIfMissing = true
}
configureHTTP()
configureErrors()

View File

@@ -1,7 +1,7 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="INFO">
@@ -9,4 +9,4 @@
</root>
<logger name="org.eclipse.jetty" level="INFO"/>
<logger name="io.netty" level="INFO"/>
</configuration>
</configuration>

View File

@@ -7,15 +7,14 @@ import kotlin.test.Test
import kotlin.test.assertEquals
class ApplicationTest {
@Test
fun testRoot() = testApplication {
application {
module()
}
client.get("/").apply {
assertEquals(HttpStatusCode.OK, status)
}
}
}