Skip to content
This repository was archived by the owner on Jan 24, 2026. It is now read-only.

Commit 6fe9f39

Browse files
author
Teynar
committed
feat(docker): dockerize application
1 parent 95a50fe commit 6fe9f39

4 files changed

Lines changed: 61 additions & 0 deletions

File tree

.dockerignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# IDE files
2+
.run/
3+
4+
# Gradle files and caches
5+
.gradle/
6+
build/
7+
8+
# VCS
9+
.git
10+
.gitignore
11+
12+
# Tests
13+
src/test/

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM eclipse-temurin:21-jdk-alpine AS build
2+
3+
WORKDIR /app
4+
5+
COPY --chown=gradle:gradle build.gradle.kts settings.gradle.kts gradle.properties gradlew /app/
6+
COPY --chown=gradle:gradle gradle/ /app/gradle/
7+
8+
RUN chmod +x ./gradlew
9+
RUN ./gradlew --no-daemon dependencies
10+
COPY --chown=gradle:gradle src/ /app/src/
11+
RUN ./gradlew build --no-daemon
12+
13+
FROM eclipse-temurin:21-jre-alpine
14+
15+
RUN addgroup -S app && adduser -S app -G app
16+
17+
WORKDIR /app
18+
19+
RUN chown root:app /app && chmod 2775 /app
20+
21+
COPY --from=build --chmod=644 /app/build/libs/*.jar /app/app.jar
22+
23+
EXPOSE 11434 1234
24+
25+
USER app
26+
27+
ENTRYPOINT ["java", "-jar", "/app/app.jar"]

build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,8 @@ graalvmNative {
5757
}
5858
}
5959

60+
tasks.named<Jar>("jar") {
61+
// only the fat “-all.jar” is needed, so we disable the plain jar
62+
// this also helps to copy the jar file in docker without knowing its filename
63+
enabled = false
64+
}

compose.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
services:
2+
proxy-as-local-model:
3+
container_name: proxy-as-local-model
4+
build:
5+
context: .
6+
volumes:
7+
- './config.yml:/app/config.yml:ro'
8+
ports:
9+
- '127.0.0.1:11434:11434'
10+
- '127.0.0.1:1234:1234'
11+
healthcheck:
12+
test: ["CMD", "sh", "-c", "nc -z localhost 11434 || nc -z localhost 1234 || exit 1"]
13+
interval: 5s
14+
timeout: 10s
15+
retries: 3
16+
restart: unless-stopped

0 commit comments

Comments
 (0)