forked from block/goose
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes block#1072 Add Docker support for Goose. * **Dockerfile** - Create a `Dockerfile` to build the Goose Docker image using a multi-stage build. - Set the entrypoint to the Goose binary. * **GitHub Actions Workflow** - Add `.github/workflows/build-docker-image.yml` to build and publish the Docker image. - Trigger the workflow on push to the main branch and on release tags. - Use Docker build and push action to build and publish the image. - Set up Docker Hub credentials as secrets in the repository. * **README.md** - Add instructions on how to build and run the Goose Docker image. - Include a section on using the Docker image for Goose. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/block/goose/issues/1072?shareId=XXXX-XXXX-XXXX-XXXX).
- Loading branch information
1 parent
691a065
commit 45e82ef
Showing
3 changed files
with
89 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,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 |
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,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"] |
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