Skip to content

Commit

Permalink
feat: initial docker config [no ci] (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
jenspots committed Jun 8, 2024
1 parent 6a5d096 commit 7e82c8d
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*
!gradle
!gradle.properties
!gradlew
!build.gradle.kts
!settings.gradle.kts
!src
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM gradle:8.8.0-jdk17-alpine as build

WORKDIR /app

# All files which may not be copied must be specified in the .dockerignore
# file.
COPY . ./

RUN gradle build -x test

FROM amazoncorretto:22.0.1-alpine3.19

# Set the working directory
WORKDIR /app

# Copy the JAR file from the build stage
COPY --from=build "/app/build/libs/technology.idlab.jvm-runner-[0-9\.]*-all.jar" runner.jar

# Set the entry point to run the application
ENTRYPOINT ["java", "-jar", "runner.jar"]
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,8 @@ publishing {
}
}
}

/** Set the maximum number of parallel forks to the number of available processors. */
tasks.withType<Test>().configureEach {
maxParallelForks = Runtime.getRuntime().availableProcessors().coerceAtLeast(1)
}
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
jvm-runner:
build:
context: .
dockerfile: Dockerfile
container_name: jvm-runner
environment:
- JAVA_OPTS=-Xmx512m
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
kotlin.code.style=official
org.gradle.parallel=true
org.gradle.daemon=true
org.gradle.configuration-cache=true
org.gradle.caching=true
org.gradle.jvmargs=-Xmx2048M

0 comments on commit 7e82c8d

Please sign in to comment.