Skip to content

Commit 726e833

Browse files
committed
e2e: build and install trust plugin
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent ea47850 commit 726e833

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,19 @@ RUN --mount=type=bind,target=.,ro \
7474
TARGET=/out ./scripts/build/binary && \
7575
xx-verify $([ "$GO_LINKMODE" = "static" ] && echo "--static") /out/docker
7676

77+
FROM build-${BASE_VARIANT} AS build-trust
78+
ARG GO_LINKMODE=static
79+
ARG GO_BUILDTAGS
80+
ARG GO_STRIP
81+
ARG CGO_ENABLED
82+
ARG VERSION
83+
RUN --mount=ro --mount=type=cache,target=/root/.cache \
84+
xx-go --wrap && \
85+
TARGET=/out ./scripts/build/trust-plugin
86+
87+
FROM scratch AS trust
88+
COPY --link --from=build-trust /out/docker-trust /
89+
7790
FROM build-${BASE_VARIANT} AS test
7891
COPY --link --from=gotestsum /out/gotestsum /usr/bin/gotestsum
7992
ENV GO111MODULE=auto
@@ -114,6 +127,7 @@ COPY --link --from=build /out ./build/
114127
COPY --link --from=build-plugins /out ./build/
115128
COPY --link --from=buildx /buildx /usr/libexec/docker/cli-plugins/docker-buildx
116129
COPY --link --from=compose /docker-compose /usr/libexec/docker/cli-plugins/docker-compose
130+
COPY --link --from=trust /docker-trust /usr/libexec/docker/cli-plugins/docker-trust
117131
COPY --link . .
118132
ENV DOCKER_BUILDKIT=1
119133
ENV PATH=/go/src/github.com/docker/cli/build:$PATH

scripts/build/trust-plugin

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Build plugins examples for the host OS/ARCH
4+
#
5+
6+
set -eu -o pipefail
7+
8+
# Disable CGO - we don't need it for these plugins.
9+
#
10+
# Important: this must be done before sourcing "./scripts/build/.variables",
11+
# because some other variables are conditionally set whether CGO is enabled.
12+
export CGO_ENABLED=0
13+
14+
source ./scripts/build/.variables
15+
16+
TARGET_PLUGIN="$(dirname "${TARGET}")/docker-trust-${GOOS}-${GOARCH}"
17+
mkdir -p "$(dirname "${TARGET_PLUGIN}")"
18+
19+
echo "Building $GO_LINKMODE $(basename "${TARGET_PLUGIN}")"
20+
(set -x ; GO111MODULE=auto go build -o "${TARGET_PLUGIN}" -tags "${GO_BUILDTAGS}" -ldflags "${GO_LDFLAGS}" ${GO_BUILDMODE} "github.com/docker/cli/cmd/docker-trust")
21+
22+
ln -sf "$(basename "${TARGET_PLUGIN}")" "$(dirname "${TARGET}")/docker-trust"

0 commit comments

Comments
 (0)