-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
152 lines (122 loc) 路 4.91 KB
/
Copy pathDockerfile
File metadata and controls
152 lines (122 loc) 路 4.91 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# syntax=docker/dockerfile:1
# Published flavors are built from the named final stages: bookworm, slim,
# and alpine. The unqualified image uses the final `default` stage, which
# intentionally aliases slim.
ARG RUST_VERSION=1.94.0
ARG DEBIAN_SUITE=bookworm
ARG ALPINE_VERSION=3.23
ARG VERSION=source
ARG REVISION=unknown
FROM rust:${RUST_VERSION}-slim-${DEBIAN_SUITE} AS builder-gnu
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
ARG TARGETARCH
COPY Cargo.toml Cargo.lock rust-toolchain.toml build.rs ./
COPY src ./src
COPY docs/user ./docs/user
RUN --mount=type=cache,id=kit-cargo-registry,sharing=locked,target=/usr/local/cargo/registry \
--mount=type=cache,id=kit-gnu-target-${TARGETARCH},sharing=locked,target=/src/target \
cargo build --locked --release --bin kit \
&& strip --strip-unneeded target/release/kit \
&& cp target/release/kit /kit
# Alpine is a separate musl build. Do not copy the glibc artifact above into
# this stage or add a libc compatibility shim to the runtime image.
FROM rust:${RUST_VERSION}-alpine${ALPINE_VERSION} AS builder-musl
RUN apk add --no-cache \
build-base \
cmake \
linux-headers \
perl \
pkgconf
WORKDIR /src
ARG TARGETARCH
COPY Cargo.toml Cargo.lock rust-toolchain.toml build.rs ./
COPY src ./src
COPY docs/user ./docs/user
RUN --mount=type=cache,id=kit-cargo-registry,sharing=locked,target=/usr/local/cargo/registry \
--mount=type=cache,id=kit-musl-target-${TARGETARCH},sharing=locked,target=/src/target \
cargo build --locked --release --bin kit \
&& strip --strip-unneeded target/release/kit \
&& cp target/release/kit /kit
FROM debian:${DEBIAN_SUITE} AS bookworm
ARG VERSION
ARG REVISION
LABEL org.opencontainers.image.title="Kit" \
org.opencontainers.image.description="Coding agent runtime and terminal client" \
org.opencontainers.image.source="https://github.com/speakeasy-api/kit" \
org.opencontainers.image.url="https://github.com/speakeasy-api/kit" \
org.opencontainers.image.documentation="https://github.com/speakeasy-api/kit#readme" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.revision="${REVISION}"
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd --gid 1000 kit \
&& useradd --uid 1000 --gid 1000 --create-home --no-log-init --shell /bin/sh kit \
&& mkdir -p /workspace \
&& chown kit:kit /workspace
COPY --from=builder-gnu /kit /usr/local/bin/kit
ENV HOME=/home/kit
WORKDIR /workspace
USER kit
EXPOSE 8081
STOPSIGNAL SIGTERM
ENTRYPOINT ["/usr/local/bin/kit"]
CMD ["--help"]
FROM debian:${DEBIAN_SUITE}-slim AS slim
ARG VERSION
ARG REVISION
LABEL org.opencontainers.image.title="Kit" \
org.opencontainers.image.description="Coding agent runtime and terminal client" \
org.opencontainers.image.source="https://github.com/speakeasy-api/kit" \
org.opencontainers.image.url="https://github.com/speakeasy-api/kit" \
org.opencontainers.image.documentation="https://github.com/speakeasy-api/kit#readme" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.revision="${REVISION}"
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd --gid 1000 kit \
&& useradd --uid 1000 --gid 1000 --create-home --no-log-init --shell /bin/sh kit \
&& mkdir -p /workspace \
&& chown kit:kit /workspace
COPY --from=builder-gnu /kit /usr/local/bin/kit
ENV HOME=/home/kit
WORKDIR /workspace
USER kit
# Remote ACP examples conventionally bind this port. Kit does not open a
# listener unless the selected command asks it to.
EXPOSE 8081
STOPSIGNAL SIGTERM
ENTRYPOINT ["/usr/local/bin/kit"]
CMD ["--help"]
FROM alpine:${ALPINE_VERSION} AS alpine
ARG VERSION
ARG REVISION
LABEL org.opencontainers.image.title="Kit" \
org.opencontainers.image.description="Coding agent runtime and terminal client" \
org.opencontainers.image.source="https://github.com/speakeasy-api/kit" \
org.opencontainers.image.url="https://github.com/speakeasy-api/kit" \
org.opencontainers.image.documentation="https://github.com/speakeasy-api/kit#readme" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.revision="${REVISION}"
RUN apk add --no-cache ca-certificates \
&& addgroup -S -g 1000 kit \
&& adduser -S -D -u 1000 -G kit -h /home/kit -s /bin/sh kit \
&& mkdir -p /workspace \
&& chown kit:kit /workspace
COPY --from=builder-musl /kit /usr/local/bin/kit
ENV HOME=/home/kit
WORKDIR /workspace
USER kit
EXPOSE 8081
STOPSIGNAL SIGTERM
ENTRYPOINT ["/usr/local/bin/kit"]
CMD ["--help"]
# Keep the unqualified image on the conservative glibc/slim flavor.
FROM slim AS default