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

Commit f50a01e

Browse files
authored
Merge pull request #17 from teynar/feat/dockerize-app
Dockerize application
2 parents 95a50fe + 6d7cbcd commit f50a01e

5 files changed

Lines changed: 113 additions & 1 deletion

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"]

README.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,59 @@ Streaming chat completion API only.
2626

2727
## How to use
2828

29-
This application is a proxy server, distributed as a fat runnable jar and a GraalVM native image (Windows x64).
29+
This application is a proxy server, and can be started in a few different ways depending on your workflow.
3030

31+
### Workflows
32+
33+
#### By source code
34+
35+
```sh
36+
# if you prefer running auto-downloading the required gradle version seamlessly (recommended)
37+
./gradlew run
38+
```
39+
40+
```sh
41+
# if you already have the required project gradle version installed
42+
gradle run
43+
```
44+
45+
#### By fat runnable jar
46+
47+
```sh
48+
# you can compile the app from the source code or download one of the github releases
49+
# if you compile it, the fat jar will be located at <repo-root>/build/libs
50+
java -jar ProxyAsLocalModel-0.0.7-all.jar
51+
```
52+
53+
#### By native GraalVM image
54+
55+
```sh
56+
# you can get download the executable from one of the github releases
57+
# either launch it through a shell or just double click it from the windows explorer
58+
./proxy.exe
59+
```
60+
61+
#### By docker compose
62+
63+
```sh
64+
# if you want to run it on the background
65+
docker compose up -d --build
66+
67+
# if you want to run it on the foreground
68+
docker compose up --build
69+
```
70+
71+
With docker compose, you can bind the config file from your local filesystem so that the config auto-reload works
72+
Replace the ./config.yml for your config.yml path
73+
74+
```yaml
75+
volumes:
76+
- './config.yml:/app/config.yml:ro'
77+
```
78+
79+
You will need to create a placeholder config.yml to start the app, check the next section for reference
80+
81+
### Start
3182
Run the application, and you will see a help message:
3283
3384
```

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)