diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3992ab0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM eclipse-temurin:25-jdk AS build +WORKDIR /build +COPY . ./ +RUN find . +RUN ./mvnw clean package -DskipTests + +FROM eclipse-temurin:25-jre +WORKDIR /app +COPY --from=build /build/target/ollama-oai-bridge.jar ./ollama-oai-bridge.jar +COPY start.sh /app/start.sh +EXPOSE 11434 +ENTRYPOINT ["/app/start.sh"] \ No newline at end of file diff --git a/README.md b/README.md index 5fac4c7..b94af65 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,18 @@ This project is licensed under the Apache License 2.0. See the `LICENSE` file fo ./start.sh -Dserver.port=11435 -Dbridge.upstream-base-url=http://localhost:5002 -Dbridge.version=0.24.1 -Dbridge.reported-context-offset=5000 ``` +### Docker + +You can build and run the application as a Docker image: + +```bash +cd docker +./build.sh +./start-docker.sh +``` + +The `build.sh` script builds a multi-stage Docker image that compiles the JAR inside Docker and packages it into a minimal runtime image. The `start-docker.sh` script runs the container with host networking. + ## Architecture - **`GatewayProxyConfiguration`**: Sets up the Spring Cloud Gateway routes to proxy requests. diff --git a/docker/build.sh b/docker/build.sh new file mode 100755 index 0000000..0dc77f3 --- /dev/null +++ b/docker/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -euo pipefail + +cd "$(dirname "$0")/.." +docker build -t ollama-oai-bridge-run:latest . \ No newline at end of file diff --git a/docker/start-docker.sh b/docker/start-docker.sh new file mode 100755 index 0000000..525b04f --- /dev/null +++ b/docker/start-docker.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -euo pipefail + +docker run --rm \ + --network=host \ + ollama-oai-bridge-run:latest "$@" \ No newline at end of file