Skip to content

Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.

[Feat]: Use Multi stage builds for Ingester Docker Image (#130)

Patcher99c6e8c6e396f9
diff --git a/README.md b/README.md
index 134546ba..560860d0 100644
--- a/README.md
+++ b/README.md
@@ -75,7 +75,7 @@ To install the Doku using Docker, follow these steps:
services:
clickhouse:
- image: clickhouse/clickhouse-server:24.1.5
+ image: clickhouse/clickhouse-server:24.2.2
container_name: clickhouse
environment:
CLICKHOUSE_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}
diff --git a/docker-compose.yml b/docker-compose.yml
index 18030d54..5c6f95ac 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -2,7 +2,7 @@ version: '3.8'
services:
clickhouse:
- image: clickhouse/clickhouse-server:24.1.5
+ image: clickhouse/clickhouse-server:24.2.2
container_name: clickhouse
environment:
CLICKHOUSE_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}
diff --git a/docs/0.1/installation.mdx b/docs/0.1/installation.mdx
index f5e1a022..88743b36 100644
--- a/docs/0.1/installation.mdx
+++ b/docs/0.1/installation.mdx
@@ -52,7 +52,7 @@ For a quick and straightforward setup, Docker Compose can be used to deploy Doku
services:
clickhouse:
- image: clickhouse/clickhouse-server:24.1.5
+ image: clickhouse/clickhouse-server:24.2.2
container_name: clickhouse
environment:
CLICKHOUSE_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}
diff --git a/docs/0.1/quickstart.mdx b/docs/0.1/quickstart.mdx
index 36034f5b..680cc41b 100644
--- a/docs/0.1/quickstart.mdx
+++ b/docs/0.1/quickstart.mdx
@@ -15,7 +15,7 @@ This guide will walk you through setting up monitoring for your LLM Application
services:
clickhouse:
- image: clickhouse/clickhouse-server:24.1.5
+ image: clickhouse/clickhouse-server:24.2.2
container_name: clickhouse
environment:
CLICKHOUSE_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}
diff --git a/docs/latest/installation.mdx b/docs/latest/installation.mdx
index 65b701de..e93cb7c3 100644
--- a/docs/latest/installation.mdx
+++ b/docs/latest/installation.mdx
@@ -52,7 +52,7 @@ For a quick and straightforward setup, Docker Compose can be used to deploy Doku
services:
clickhouse:
- image: clickhouse/clickhouse-server:24.1.5
+ image: clickhouse/clickhouse-server:24.2.2
container_name: clickhouse
environment:
CLICKHOUSE_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}
diff --git a/docs/latest/quickstart.mdx b/docs/latest/quickstart.mdx
index f0363d90..208d186c 100644
--- a/docs/latest/quickstart.mdx
+++ b/docs/latest/quickstart.mdx
@@ -15,7 +15,7 @@ This guide will walk you through setting up monitoring for your LLM Application
services:
clickhouse:
- image: clickhouse/clickhouse-server:24.1.5
+ image: clickhouse/clickhouse-server:24.2.2
container_name: clickhouse
environment:
CLICKHOUSE_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}
diff --git a/src/README.md b/src/README.md
new file mode 100644
index 00000000..e255364e
--- /dev/null
+++ b/src/README.md
@@ -0,0 +1,27 @@
+# Testing and Developing Locally
+
+This guide covers the steps needed to set up the development environment for Doku Stack using Docker Compose. Our setup includes two main components: `ingester` and `client`, both of which are orchestrated by a Docker Compose file named `dev-docker-compose.yml`.
+
+## Running the Development Environment
+
+To run the development environment, follow these steps:
+
+1. Open a terminal and set context as this directory ()`/src`).
+
+3. Use the following Docker Compose command to build and start the containers as specified in the `dev-docker-compose.yml` file:
+
+ ```
+ docker-compose -f dev-docker-compose.yml up --build
+ ```
+
+ The `--build` flag ensures that Docker builds images for our services (if needed) before starting the containers.
+
+4. Once the command completes, the `ingester` and `client` services should be running in containers, and you can access Doku Client at 127.0.0.1:3000 and Doku Ingester at `127.0.0.1:9044`.
+
+5. To stop the services and remove the containers, you can use the following command:
+
+ ```
+ docker-compose -f dev-docker-compose.yml down
+ ```
+
+This command stops all running containers and removes them along with their networks. It's a clean way to shut down your development environment.
diff --git a/src/dev-docker-compose.yml b/src/dev-docker-compose.yml
new file mode 100644
index 00000000..ed23c1d2
--- /dev/null
+++ b/src/dev-docker-compose.yml
@@ -0,0 +1,58 @@
+version: '3.8'
+
+services:
+ clickhouse:
+ image: clickhouse/clickhouse-server:24.2.2
+ container_name: clickhouse
+ environment:
+ CLICKHOUSE_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}
+ CLICKHOUSE_USER: ${DOKU_DB_USER:-default}
+ volumes:
+ - clickhouse-data:/var/lib/clickhouse
+ ports:
+ - "9000:9000"
+ - "8123:8123"
+ restart: always
+
+ doku-ingester:
+ image: doku-ingester
+ build:
+ context: ./ingester
+ dockerfile: Dockerfile
+ container_name: doku-ingester
+ environment:
+ DOKU_DB_HOST: clickhouse
+ DOKU_DB_PORT: 9000
+ DOKU_DB_NAME: ${DOKU_DB_NAME:-default}
+ DOKU_DB_USER: ${DOKU_DB_USER:-default}
+ DOKU_DB_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}
+ ports:
+ - "9044:9044"
+ depends_on:
+ - clickhouse
+ restart: always
+
+ doku-client:
+ image: doku-client
+ build:
+ context: ./client
+ dockerfile: Dockerfile
+ container_name: doku-client
+ environment:
+ INIT_DB_HOST: clickhouse
+ INIT_DB_PORT: 8123
+ INIT_DB_DATABASE: ${DOKU_DB_NAME:-default}
+ INIT_DB_USERNAME: ${DOKU_DB_USER:-default}
+ INIT_DB_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}
+ SQLITE_DATABASE_URL: file:/app/client/data/data.db
+ ports:
+ - "3000:3000"
+ depends_on:
+ - clickhouse
+ volumes:
+ - doku-client-data:/app/client/data
+ restart: always
+
+volumes:
+ clickhouse-data:
+ doku-client-data:
\ No newline at end of file
diff --git a/src/ingester/Dockerfile b/src/ingester/Dockerfile
index 4b87d571..96a873b2 100644
--- a/src/ingester/Dockerfile
+++ b/src/ingester/Dockerfile
@@ -1,20 +1,30 @@
-# Use the official Go image as the base image
-FROM golang:1.21.5
+# Build stage
+FROM golang:1.22.1-alpine3.19 AS builder
-# Set the working directory to /app
-WORKDIR /app
+# Set the working directory
+WORKDIR /app
-COPY go.mod .
-COPY go.sum .
-
-# Download dependencies in a separate layer to leverage Docker cache
+# Copy the Go Modules manifests and download dependencies
+COPY go.mod go.sum ./
RUN go mod download
-# Now copy the rest of your source code.
+# Copy the rest of the source code
COPY . .
-# Build the Go application and name the executable as "ingester"
-RUN go build -o ingester
+# Build the Go application and name the executable "ingester"
+RUN CGO_ENABLED=0 go build -o ingester
+
+# Final stage: Use a minimal alpine image
+FROM alpine:3.19
+
+# Install ca-certificates in case your application makes outgoing HTTPS requests
+RUN apk --no-cache add ca-certificates
+
+# Set the working directory
+WORKDIR /app
+
+# Copy the binary from the builder stage
+COPY --from=builder /app/ingester .
# Command to run the executable
CMD ["./ingester"]
\ No newline at end of file
diff --git a/src/ingester/go.mod b/src/ingester/go.mod
index 2f3b7c70..839570fd 100644
--- a/src/ingester/go.mod
+++ b/src/ingester/go.mod
@@ -1,6 +1,6 @@
module ingester
-go 1.21.5
+go 1.22.1
require (
github.com/ClickHouse/clickhouse-go/v2 v2.22.2