forked from block/goose
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
73 lines (60 loc) · 1.85 KB
/
Dockerfile
File metadata and controls
73 lines (60 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# syntax=docker/dockerfile:1.4
# goose CLI and Server Docker Image
# Multi-stage build for minimal final image size
# Build stage
FROM rust:1.82-bookworm AS builder
# Install build dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
pkg-config \
libssl-dev \
libdbus-1-dev \
protobuf-compiler \
libprotobuf-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /build
# Copy source code
COPY . .
# Build release binaries with optimizations
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
ENV CARGO_PROFILE_RELEASE_LTO=true
ENV CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
ENV CARGO_PROFILE_RELEASE_OPT_LEVEL=z
ENV CARGO_PROFILE_RELEASE_STRIP=true
RUN cargo build --release --package goose-cli
# Runtime stage - minimal Debian
FROM debian:bookworm-slim@sha256:b1a741487078b369e78119849663d7f1a5341ef2768798f7b7406c4240f86aef
# Install only runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
libssl3 \
libdbus-1-3 \
libxcb1 \
curl \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy binary from builder
COPY --from=builder /build/target/release/goose /usr/local/bin/goose
# Create non-root user
RUN useradd -m -u 1000 -s /bin/bash goose && \
mkdir -p /home/goose/.config/goose && \
chown -R goose:goose /home/goose
# Set up environment
ENV PATH="/usr/local/bin:${PATH}"
ENV HOME="/home/goose"
# Switch to non-root user
USER goose
WORKDIR /home/goose
# Default to goose CLI
ENTRYPOINT ["/usr/local/bin/goose"]
CMD ["--help"]
# Labels for metadata
LABEL org.opencontainers.image.title="goose"
LABEL org.opencontainers.image.description="goose CLI"
LABEL org.opencontainers.image.vendor="Block"
LABEL org.opencontainers.image.source="https://github.com/block/goose"