-
Notifications
You must be signed in to change notification settings - Fork 645
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds Docker support to goose via a multi-stage Dockerfile that: - Uses rust:1.75 for building - Uses debian:bookworm-slim for runtime - Includes required system dependencies - Provides documentation for Docker usage The Docker image allows running goose without installing Rust locally and provides a consistent runtime environment.
- Loading branch information
Ben Levy
authored and
Ben Levy
committed
Feb 5, 2025
1 parent
180dff9
commit 7ec9784
Showing
3 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Docker Support for Goose | ||
|
||
This PR adds Docker support to make it easier to run goose in containerized environments. | ||
|
||
## Changes | ||
- Adds a Dockerfile that builds goose from source using multi-stage builds | ||
- Documents Docker usage in README | ||
|
||
## Testing Done | ||
Verified the Docker image builds and runs successfully: | ||
```bash | ||
docker build -t goose . | ||
docker run goose --version # Outputs: 1.0.4 | ||
``` | ||
|
||
## Technical Details | ||
The Dockerfile uses a multi-stage build approach: | ||
1. Build stage: Uses rust:1.75 to compile the application | ||
2. Runtime stage: Uses debian:bookworm-slim for a minimal runtime image | ||
|
||
Key runtime dependencies are included: | ||
- libssl3 and ca-certificates for TLS/networking | ||
- libdbus-1-3 for D-Bus support | ||
- libxcb libs for X11 support | ||
|
||
## Screenshot | ||
N/A - CLI tool | ||
|
||
## Motivation | ||
Making goose available as a Docker image provides several benefits: | ||
1. Consistent runtime environment | ||
2. Easy deployment in containerized environments | ||
3. No need to install Rust toolchain for running goose | ||
|
||
## Notes | ||
The final image size could potentially be reduced further using Alpine Linux or scratch images, | ||
but this would require cross-compilation support. The current approach prioritizes reliability | ||
and ease of maintenance. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Build stage | ||
FROM rust:1.75 as builder | ||
|
||
WORKDIR /usr/src/goose | ||
COPY . . | ||
|
||
# Install required dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y pkg-config libssl-dev libdbus-1-dev && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Build the application | ||
RUN cargo build --release | ||
|
||
# Runtime stage | ||
FROM debian:bookworm-slim | ||
|
||
WORKDIR /app | ||
|
||
# Install runtime dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y libssl3 ca-certificates libdbus-1-3 libxcb1 libxcb-render0 libxcb-shape0 libxcb-xfixes0 && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy the binary from builder | ||
COPY --from=builder /usr/src/goose/target/release/goose /app/goose | ||
|
||
# Set the binary as the entrypoint | ||
ENTRYPOINT ["/app/goose"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
## Docker Support | ||
|
||
You can run goose using Docker: | ||
|
||
```bash | ||
# Build the image | ||
docker build -t goose . | ||
|
||
# Run goose commands | ||
docker run goose --version | ||
docker run goose --help | ||
``` | ||
|
||
### Custom Configuration | ||
You can mount a configuration directory to persist settings: | ||
```bash | ||
docker run -v ~/.config/goose:/root/.config/goose goose <command> | ||
``` |