diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml
index 77cd29c2b..63b6cae8f 100644
--- a/.github/workflows/build-cli.yml
+++ b/.github/workflows/build-cli.yml
@@ -77,3 +77,27 @@ jobs:
with:
name: goose-${{ matrix.architecture }}-${{ matrix.target-suffix }}
path: ${{ env.ARTIFACT }}
+
+ build-docker:
+ name: Build and Publish Docker Image
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v2
+
+ - name: Log in to Docker Hub
+ uses: docker/login-action@v2
+ with:
+ username: ${{ secrets.DOCKER_USERNAME }}
+ password: ${{ secrets.DOCKER_PASSWORD }}
+
+ - name: Build and Push Docker Image
+ uses: docker/build-push-action@v3
+ with:
+ context: .
+ file: ./Dockerfile
+ push: true
+ tags: ${{ secrets.DOCKER_USERNAME }}/goose:${{ inputs.version }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 5d97c7a36..5453043c9 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -88,3 +88,31 @@ jobs:
allowUpdates: true
omitBody: true
omitPrereleaseDuringUpdate: true
+
+ # ------------------------------------
+ # 5) Build and Publish Docker Image
+ # ------------------------------------
+ build-docker:
+ name: Build and Publish Docker Image
+ runs-on: ubuntu-latest
+ needs: [build-cli]
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v2
+
+ - name: Log in to Docker Hub
+ uses: docker/login-action@v2
+ with:
+ username: ${{ secrets.DOCKER_USERNAME }}
+ password: ${{ secrets.DOCKER_PASSWORD }}
+
+ - name: Build and Push Docker Image
+ uses: docker/build-push-action@v3
+ with:
+ context: .
+ file: ./Dockerfile
+ push: true
+ tags: ${{ secrets.DOCKER_USERNAME }}/goose:${{ github.ref_name }}
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000..bb5e6ee63
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,23 @@
+# Use a multi-stage build to compile the goose binary and create a minimal image
+
+# Stage 1: Build the goose binary
+FROM rust:1.56 as builder
+
+WORKDIR /app
+
+# Copy the source code
+COPY . .
+
+# Build the goose binary
+RUN cargo build --release --package goose-cli
+
+# Stage 2: Create a minimal image
+FROM debian:buster-slim
+
+WORKDIR /app
+
+# Copy the goose binary from the builder stage
+COPY --from=builder /app/target/release/goose /usr/local/bin/goose
+
+# Set the entrypoint to the goose binary
+ENTRYPOINT ["goose"]
diff --git a/documentation/docs/getting-started/installation.md b/documentation/docs/getting-started/installation.md
index 6fb100873..a565a3891 100644
--- a/documentation/docs/getting-started/installation.md
+++ b/documentation/docs/getting-started/installation.md
@@ -97,6 +97,20 @@ import RateLimits from '@site/src/components/RateLimits';
```
+
+ Run the following command to pull the Goose Docker image from Docker Hub:
+
+ ```sh
+ docker pull block/goose:latest
+ ```
+
+ To run Goose in a Docker container, use the following command:
+
+ ```sh
+ docker run --rm -it block/goose:latest
+ ```
+
+
:::tip Updating Goose
@@ -224,6 +238,12 @@ Goose works with a set of [supported LLM providers][providers], and you’ll nee
Type your questions, tasks, or instructions directly into the input field, and Goose will get to work immediately.
+
+ To run Goose in a Docker container, use the following command:
+ ```sh
+ docker run --rm -it block/goose:latest
+ ```
+
## Additional Resources