Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker image for Goose #1119

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Publish Docker Image

on:
push:
branches:
- main
release:
types: [published]

jobs:
build:
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_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/goose:latest
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Use a multi-stage build to minimize the final image size

# Stage 1: Build the Goose binary
FROM rust:latest AS builder

# Set the working directory
WORKDIR /app

# Copy the Cargo.toml and Cargo.lock files
COPY Cargo.toml Cargo.lock ./

# Copy the source code
COPY . .

# Build the Goose binary
RUN cargo build --release --package goose-cli

# Stage 2: Create the final image
FROM debian:buster-slim

# Set the working directory
WORKDIR /app

# Copy the Goose binary from the build stage
COPY --from=builder /app/target/release/goose /usr/local/bin/goose

# Set the entrypoint to the Goose binary
ENTRYPOINT ["goose"]
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,32 @@ codename goose

Check out our [documentation](https://block.github.io/goose), or to try it out head to the [installation](https://block.github.io/goose/docs/getting-started/installation) instructions!

## Using the Goose Docker Image

You can now use the official Goose Docker image to run Goose in a containerized environment. Follow the instructions below to build and run the Goose Docker image.

### Building the Docker Image

To build the Goose Docker image, run the following command in the root directory of the repository:

```sh
docker build -t goose:latest .
```

### Running the Docker Image

To run the Goose Docker image, use the following command:

```sh
docker run --rm -it goose:latest
```

This will start the Goose CLI in an interactive terminal session.

You can also pass additional arguments to the Goose CLI by appending them to the `docker run` command. For example, to run a specific Goose command, use:

```sh
docker run --rm -it goose:latest <command>
```

Replace `<command>` with the desired Goose command and its arguments.