-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
72 lines (57 loc) · 2.63 KB
/
Copy pathDockerfile
File metadata and controls
72 lines (57 loc) · 2.63 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
FROM --platform=$BUILDPLATFORM node:24-alpine@sha256:50c8e8ca1d27439048670df5883f32d57cf81cff6233222c893fd0d9884cbd81 AS console
WORKDIR /src
RUN npm install -g pnpm@11.22.0
COPY console/package.json console/pnpm-lock.yaml ./console/
RUN pnpm -C console install --frozen-lockfile
COPY console ./console
COPY go.mod ./
COPY docs ./docs
ARG VERSION=dev
ARG COMMIT=unknown
RUN if [ "$COMMIT" != unknown ]; then export STARPORT_DOCS_COMMIT="$COMMIT"; fi \
&& STARPORT_DOCS_RELEASE="$VERSION" pnpm -C console build
FROM --platform=$BUILDPLATFORM golang:1.27.1-alpine@sha256:cf6fca6641884b8433441b2b0652976f975e1d0fdd26d177eaaf8596087f3125 AS build
ENV GOTOOLCHAIN=go1.27.1
ARG TARGETOS
ARG TARGETARCH
ARG VERSION=dev
ARG COMMIT=unknown
ARG BUILD_TIME=unknown
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
COPY --from=console /src/internal/console/dist ./internal/console/dist
RUN CGO_ENABLED=0 GOOS="$TARGETOS" GOARCH="$TARGETARCH" go build \
-trimpath \
-buildvcs=false \
-ldflags="-s -w -X main.version=$VERSION -X main.buildTime=$BUILD_TIME -X main.gitCommit=$COMMIT -X main.gitBranch=release" \
-o /out/starport ./cmd/starport \
&& mkdir -p /out/config /out/data /out/state /out/cache
FROM gcr.io/distroless/static-debian12:nonroot@sha256:f5b485ea962d9bd1186b2f6b3a061191539b905b82ec395de78cbfae51f20e35
ARG VERSION=dev
ARG COMMIT=unknown
ARG BUILD_TIME=unknown
LABEL org.opencontainers.image.title="Starport" \
org.opencontainers.image.description="OpenAI- and OpenRouter-compatible LLM inference gateway" \
org.opencontainers.image.created="$BUILD_TIME" \
org.opencontainers.image.revision="$COMMIT" \
org.opencontainers.image.version="$VERSION" \
org.opencontainers.image.source="https://github.com/agentstation/starport" \
org.opencontainers.image.licenses="AGPL-3.0-only"
COPY --from=build --chown=65532:65532 /out/starport /usr/local/bin/starport
# Recovery refuses private state roots that grant group or other access.
COPY --from=build --chown=65532:65532 --chmod=0700 /out/config /var/lib/starport/config
COPY --from=build --chown=65532:65532 --chmod=0700 /out/data /var/lib/starport/data
COPY --from=build --chown=65532:65532 --chmod=0700 /out/state /var/lib/starport/state
COPY --from=build --chown=65532:65532 --chmod=0700 /out/cache /var/lib/starport/cache
ENV STARPORT_CONFIG_DIR=/var/lib/starport/config/starport \
STARPORT_DATA_DIR=/var/lib/starport/data \
STARPORT_STATE_ROOT=/var/lib/starport/state \
STARPORT_CACHE_DIR=/var/lib/starport/cache \
STARPORT_SERVER_HOST=0.0.0.0
WORKDIR /var/lib/starport
USER 65532:65532
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/starport"]
CMD ["serve"]