docker-compose
RUNNING
History Source
SummaryIterations2Transcript23Dockerfile
01Iteration 1
WRITEWriteFile· step #1
0s
Dockerfile10767 chars
text271 lines · 10767 chars
# syntax=docker/dockerfile:1


ARG GO_VERSION=1.26.3
ARG XX_VERSION=1.9.0
ARG GOLANGCI_LINT_VERSION=v2.11.3
ARG ADDLICENSE_VERSION=v1.0.0

ARG BUILD_TAGS="e2e"
ARG DOCS_FORMATS="md,yaml"
ARG LICENSE_FILES=".*\(Dockerfile\|Makefile\|\.go\|\.hcl\|\.sh\)"

# xx is a helper for cross-compilation
FROM --platform=${BUILDPLATFORM} tonistiigi/xx:${XX_VERSION} AS xx

# osxcross contains the MacOSX cross toolchain for xx
FROM crazymax/osxcross:15.5-alpine AS osxcross

FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint
FROM ghcr.io/google/addlicense:${ADDLICENSE_VERSION} AS addlicense

FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine3.23 AS base
COPY --from=xx / /
RUN apk add --no-cache \
      clang \
      docker \
      file \
      findutils \
      git \
      make \
      protoc \
      protobuf-dev
WORKDIR /src
ENV CGO_ENABLED=0

FROM base AS build-base
COPY go.* .
RUN --mount=type=cache,target=/go/pkg/mod \
    --mount=type=cache,target=/root/.cache/go-build \
    go mod download

FROM build-base AS vendored
RUN --mount=type=bind,target=.,rw \
    --mount=type=cache,target=/go/pkg/mod \
    go mod tidy && mkdir /out && cp go.mod go.sum /out

FROM scratch AS vendor-update
COPY --from=vendored /out /

FROM vendored AS vendor-validate
RUN --mount=type=bind,target=.,rw <<EOT
  set -e
  git add -A
  cp -rf /out/* .
  diff=$(git status --porcelain -- go.mod go.sum)
  if [ -n "$diff" ]; then
    echo >&2 'ERROR: Vendor result differs. Please vendor your package with "make go-mod-tidy"'
    echo "$diff"
    exit 1
  fi
EOT

FROM build-base AS build
ARG BUILD_TAGS
ARG BUILD_FLAGS
ARG TARGETPLATFORM
RUN --mount=type=bind,target=. \
    --mount=type=cache,target=/root/.cache \
    --mount=type=cache,target=/go/pkg/mod \
    --mount=type=bind,from=osxcross,src=/osxsdk,target=/xx-sdk \
    xx-go --wrap && \
    if [ "$(xx-info os)" == "darwin" ]; then export CGO_ENABLED=1; export BUILD_TAGS=fsnotify,$BUILD_TAGS; fi && \
    make build GO_BUILDTAGS="$BUILD_TAGS" DESTDIR=/out && \
    xx-verify --static /out/docker-compose

FROM build-base AS binary-unix
COPY --link --from=build /out/docker-compose /
FROM binary-unix AS binary-darwin
FROM binary-unix AS binary-linux
FROM scratch AS binary-windows
COPY --link --from=build /out/docker-compose /docker-compose.exe
FROM binary-$TARGETOS AS binary
# enable scanning for this stage
ARG BUILDKIT_SBOM_SCAN_STAGE=true

FROM --platform=${BUILDPLATFORM} alpine AS releaser
WORKDIR /work
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
RUN --mount=from=binary \
    mkdir -p /out && \
    # TODO: should just use standard arch
    TARGETARCH=$([ "$TARGETARCH" = "amd64" ] && echo "x86_64" || echo "$TARGETARCH"); \
    TARGETARCH=$([ "$TARGETARCH" = "arm64" ] && echo "aarch64" || echo "$TARGETARCH"); \
    cp docker-compose* "/out/docker-compose-${TARGETOS}-${TARGETARCH}${TARGETVARIANT}$(ls docker-compose* | sed -e 's/^docker-compose//')"

FROM scratch AS release
COPY --from=releaser /out/ /

FROM --platform=$BUILDPLATFORM alpine AS module-releaser
WORKDIR /work
ARG TARGETOS
RUN --mount=from=binary \
    mkdir -p /cli-plugins/compose/$TARGETOS && \
    cp docker-compose* "/cli-plugins/compose/$TARGETOS/docker-compose$(ls docker-compose* | sed -e 's/^docker-compose//')"

FROM scratch AS module
ARG TARGETOS
COPY --from=module-releaser /cli-plugins/compose/$TARGETOS /cli-plugins/compose/$TARGETOS
COPY ./desktop-module/module-metadata.json /
COPY LICENSE /

--- go.mod ---
module github.com/docker/compose/v5

go 1.25.5

require (
	github.com/AlecAivazis/survey/v2 v2.3.7
	github.com/DefangLabs/secret-detector v0.0.0-20250403165618-22662109213e
	github.com/Microsoft/go-winio v0.6.2
	github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
	github.com/buger/goterm v1.0.4
	github.com/compose-spec/compose-go/v2 v2.10.2
	github.com/containerd/console v1.0.5
	github.com/containerd/containerd/v2 v2.2.3
	github.com/containerd/errdefs v1.0.0
	github.com/containerd/platforms v1.0.0-rc.4
	github.com/creack/pty v1.1.24
	github.com/distribution/reference v0.6.0
	github.com/docker/buildx v0.33.0
	github.com/docker/cli v29.4.3+incompatible
	github.com/docker/cli-docs-tool v0.11.0
	github.com/docker/go-units v0.5.0
	github.com/eiannone/keyboard v0.0.0-20220611211555-0d226195f203
	github.com/fsnotify/fsevents v0.2.0
	github.com/go-viper/mapstructure/v2 v2.5.0
	github.com/google/go-cmp v0.7.0
	github.com/google/uuid v1.6.0
	github.com/hashicorp/go-version v1.9.0
	github.com/jonboulle/clockwork v0.5.0
	github.com/mattn/go-shellwords v1.0.13
	github.com/mitchellh/go-ps v1.0.0
	github.com/moby/buildkit v0.29.0
	github.com/moby/go-archive v0.2.0
	github.com/moby/moby/api v1.54.2
	github.com/moby/moby/client v0.4.1
	github.com/moby/patternmatcher v0.6.1
	github.com/moby/sys/atomicwriter v0.1.0
	github.com/morikuni/aec v1.1.0
	go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0
	go.opentelemetry.io/otel v1.43.0
	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0
	go.opentelemetry.io/otel/metric v1.43.0
	go.opentelemetry.io/otel/sdk v1.43.0
	go.opentelemetry.io/otel/trace v1.43.0
	go.uber.org/goleak v1.3.0
	go.uber.org/mock v0.6.0
	go.yaml.in/yaml/v4 v4.0.0-rc.4
	golang.org/x/sync v0.20.0
	golang.org/x/sys v0.42.0
	google.golang.org/grpc v1.81.0
	gotest.tools/v3 v3.5.2
	tags.cncf.io/container-device-interface v1.1.0
)

require (
	github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
	github.com/cenkalti/backoff/v5 v5.0.3 // indirect
	github.com/cespare/xxhash/v2 v2.3.0 // indirect
	github.com/containerd/containerd/api v1.10.0 // indirect
	github.com/containerd/continuity v0.4.5 // indirect
	github.com/containerd/errdefs/pkg v0.3.0 // indirect
	github.com/containerd/log v0.1.0 // indirect
	github.com/containerd/ttrpc v1.2.8 // indirect
	github.com/containerd/typeurl/v2 v2.2.3 // indirect
	github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
	github.com/docker/distribution v2.8.3+incompatible // indirect
	github.com/docker/docker v28.5.2+incompatible // indirect
	github.com/docker/docker-credential-helpers v0.9.5 // indirect
	github.com/docker/go-connections v0.7.0 // indirect
	github.com/felixge/httpsnoop v1.0.4 // indirect
	github.com/fvbommel/sortorder v1.1.0 // indirect
	github.com/go-logr/logr v1.4.3 // indirect
	github.com/go-logr/stdr v1.2.2 // indirect
	github.com/gofrs/flock v0.13.0 // indirect
	github.com/gogo/protobuf v1.3.2 // indirect
	github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
	github.com/golang/protobuf v1.5.4 // indirect
	github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
	github.com/gorilla/mux v1.8.1 // indirect
	github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
	github.com/hashicorp/errwrap v1.1.0 // indirect
	github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
	github.com/hashicorp/go-multierror v1.1.1 // indirect
	github.com/in-toto/attestation v1.1.2 // indirect
	github.com/in-toto/in-toto-golang v0.10.0 // indirect
	github.com/inconshreveable/mousetrap v1.1.0 // indirect
	github.com/inhies/go-bytesize v0.0.0-20220417184213-4913239db9cf // indirect
	github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
	github.com/klauspost/compress v1.18.5 // indirect
	github.com/mattn/go-colorable v0.1.14 // indirect
	github.com/mattn/go-isatty v0.0.20 // indirect
	github.com/mattn/go-runewidth v0.0.16 // indirect
	github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
	github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
	github.com/moby/docker-image-spec v1.3.1 // indirect
	github.com/moby/locker v1.0.1 // indirect
	github.com/moby/sys/capability v0.4.0 // indirect
	github.com/moby/sys/sequential v0.6.0 // indirect
	github.com/moby/sys/signal v0.7.1 // indirect
	github.com/moby/sys/symlink v0.3.0 // indirect
	github.com/moby/sys/user v0.4.0 // indirect
	github.com/moby/sys/userns v0.1.0 // indirect
	github.com/moby/term v0.5.2 // indirect
	github.com/otiai10/mint v1.6.3 // indirect
	github.com/pelletier/go-toml/v2 v2.2.4 // indirect
	github.com/pkg/errors v0.9.1 // indirect
	github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
	github.com/rivo/uniseg v0.4.7 // indirect
	github.com/russross/blackfriday/v2 v2.1.0 // indirect
	github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 // indirect
	github.com/secure-systems-lab/go-securesystemslib v0.10.0 // indirect
	github.com/shibumi/go-pathspec v1.3.0 // indirect
	github.com/sigstore/sigstore v1.10.4 // indirect
	github.com/sigstore/sigstore-go v1.1.4 // indirect
	github.com/tonistiigi/dchapes-mode v0.0.0-20250318174251-73d941a28323 // indirect
	github.com/tonistiigi/fsutil v0.0.0-20251211185533-a2aa163d723f // indirect
	github.com/tonistiigi/go-csvvalue v0.0.0-20240814133006-030d3b2625d0 // indirect
	github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect
	github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab // indirect
	github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
	go.opentelemetry.io/auto/sdk v1.2.1 // indirect
	go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 // indirect
	go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 // indirect
	go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.42.0 // indirect
	go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.42.0 // indirect
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0 // indirect
	go.opentelemetry.io/otel/sdk/metric v1.43.0 // indirect
	go.opentelemetry.io/proto/otlp v1.9.0 // indirect
	go.yaml.in/yaml/v3 v3.0.4 // indirect
)

exclude (
	// FIXME(thaJeztah): remove this once kubernetes updated their dependencies to no longer need this.
	//
	// For additional details, see this PR and links mentioned in that PR:
	// https://github.com/kubernetes-sigs/kustomize/pull/5830#issuecomment-2569960859
	github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
	github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
)

--- Makefile ---
#   Copyright 2020 Docker Compose CLI authors
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at

#       http://www.apache.org/licenses/LICENSE-2.0

#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

# ...
VERIFYVerifyBuild· step #2
0s
VerifyBuildrejected
Concerns: No Dockerfile found at repo root
WRITEWriteFile· step #3
0s
Dockerfile3541 chars
text118 lines · 3541 chars
# syntax=docker/dockerfile:1


ARG GO_VERSION=1.26.3
ARG XX_VERSION=1.9.0
ARG GOLANGCI_LINT_VERSION=v2.11.3
ARG ADDLICENSE_VERSION=v1.0.0

ARG BUILD_TAGS="e2e"
ARG DOCS_FORMATS="md,yaml"
ARG LICENSE_FILES=".*\(Dockerfile\|Makefile\|\.go\|\.hcl\|\.sh\)"

# BuildKit platform arguments
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH

# xx is a helper for cross-compilation
FROM --platform=${BUILDPLATFORM} tonistiigi/xx:${XX_VERSION} AS xx

# osxcross contains the MacOSX cross toolchain for xx
FROM crazymax/osxcross:15.5-alpine AS osxcross

FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint
FROM ghcr.io/google/addlicense:${ADDLICENSE_VERSION} AS addlicense

FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine3.23 AS base
COPY --from=xx / /
RUN apk add --no-cache \
      clang \
      docker \
      file \
      findutils \
      git \
      make \
      protoc \
      protobuf-dev
WORKDIR /src
ENV CGO_ENABLED=0

FROM base AS build-base
COPY go.* .
RUN --mount=type=cache,target=/go/pkg/mod \
    --mount=type=cache,target=/root/.cache/go-build \
    go mod download

FROM build-base AS vendored
RUN --mount=type=bind,target=.,rw \
    --mount=type=cache,target=/go/pkg/mod \
    go mod tidy && mkdir /out && cp go.mod go.sum /out

FROM scratch AS vendor-update
COPY --from=vendored /out /

FROM vendored AS vendor-validate
RUN --mount=type=bind,target=.,rw <<EOT
  set -e
  git add -A
  cp -rf /out/* .
  diff=$(git status --porcelain -- go.mod go.sum)
  if [ -n "$diff" ]; then
    echo >&2 'ERROR: Vendor result differs. Please vendor your package with "make go-mod-tidy"'
    echo "$diff"
    exit 1
  fi
EOT

FROM build-base AS build
ARG BUILD_TAGS
ARG BUILD_FLAGS
ARG TARGETPLATFORM
RUN --mount=type=bind,target=. \
    --mount=type=cache,target=/root/.cache \
    --mount=type=cache,target=/go/pkg/mod \
    --mount=type=bind,from=osxcross,src=/osxsdk,target=/xx-sdk \
    xx-go --wrap && \
    if [ "$(xx-info os)" == "darwin" ]; then export CGO_ENABLED=1; export BUILD_TAGS=fsnotify,$BUILD_TAGS; fi && \
    make build GO_BUILDTAGS="$BUILD_TAGS" DESTDIR=/out && \
    xx-verify --static /out/docker-compose

FROM build-base AS binary-unix
COPY --link --from=build /out/docker-compose /
FROM binary-unix AS binary-darwin
FROM binary-unix AS binary-linux
FROM scratch AS binary-windows
COPY --link --from=build /out/docker-compose /docker-compose.exe
FROM binary-$TARGETOS AS binary
# enable scanning for this stage
ARG BUILDKIT_SBOM_SCAN_STAGE=true

FROM --platform=${BUILDPLATFORM} alpine AS releaser
WORKDIR /work
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
RUN --mount=from=binary \
    mkdir -p /out && \
    # TODO: should just use standard arch
    TARGETARCH=$([ "$TARGETARCH" = "amd64" ] && echo "x86_64" || echo "$TARGETARCH"); \
    TARGETARCH=$([ "$TARGETARCH" = "arm64" ] && echo "aarch64" || echo "$TARGETARCH"); \
    cp docker-compose* "/out/docker-compose-${TARGETOS}-${TARGETARCH}${TARGETVARIANT}$(ls docker-compose* | sed -e 's/^docker-compose//')"

FROM scratch AS release
COPY --from=releaser /out/ /

FROM --platform=$BUILDPLATFORM alpine AS module-releaser
WORKDIR /work
ARG TARGETOS
RUN --mount=from=binary \
    mkdir -p /cli-plugins/compose/$TARGETOS && \
    cp docker-compose* "/cli-plugins/compose/$TARGETOS/docker-compose$(ls docker-compose* | sed -e 's/^docker-compose//')"

FROM scratch AS module
ARG TARGETOS
COPY --from=module-releaser /cli-plugins/compose/$TARGETOS /cli-plugins/compose/$TARGETOS
COPY ./desktop-module/module-metadata.json /
COPY LICENSE /
WRITEWriteFile· step #4
0s
Dockerfile770 bytes written
text26 lines · 770 chars
# syntax=docker/dockerfile:1
# Simple multi-stage build: build from Go, then copy the binary to a scratch container

ARG BUILD_TAGS="e2e"

FROM golang:tip-alpine3.23 AS build
ENV CGO_ENABLED=0
WORKDIR /src
RUN apk add --no-cache --no-progress clang docker file findutils git make protoc protobuf-dev

# Cache Go modules separately
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
    --mount=type=cache,target=/root/.cache/go-build \
    go mod download

COPY . .
RUN --mount=type=bind,target=. \
    --mount=type=cache,target=/root/.cache \
    --mount=type=cache,target=/go/pkg/mod \
    make build GO_BUILDTAGS="${BUILD_TAGS}" DESTDIR=/out

FROM scratch AS runtime
COPY --from=build /out/docker-compose /docker-compose
ENTRYPOINT ["/docker-compose"]
WRITEWriteFile· step #5
0s
.dockerignore120 bytes written
dockerignore20 lines · 120 chars
.git
node_modules
vendor
**/vendor
build
bin
out
.venv
*.exe
*.dll
*.so
*.dylib
*.png
*.jpg
*.jpeg
*.gif
*.md
*.mdx
"""
VERIFYVerifyBuild· step #6
10m 41s
VerifyBuildbuild_failed
Build error
Build timed out after 600s
WRITEWriteFile· step #7
0s
Dockerfile6937 chars
text211 lines · 6937 chars
# syntax=docker/dockerfile:1


#   Copyright 2020 Docker Compose CLI authors

#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at

#       http://www.apache.org/licenses/LICENSE-2.0

#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

ARG GO_VERSION=1.26.3
ARG XX_VERSION=1.9.0
ARG GOLANGCI_LINT_VERSION=v2.11.3
ARG ADDLICENSE_VERSION=v1.0.0

ARG BUILD_TAGS="e2e"
ARG DOCS_FORMATS="md,yaml"
ARG LICENSE_FILES=".*\(Dockerfile\|Makefile\|\.go\|\.hcl\|\.sh\)"

# xx is a helper for cross-compilation
FROM --platform=${BUILDPLATFORM} tonistiigi/xx:${XX_VERSION} AS xx

# osxcross contains the MacOSX cross toolchain for xx
FROM crazymax/osxcross:15.5-alpine AS osxcross

FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint
FROM ghcr.io/google/addlicense:${ADDLICENSE_VERSION} AS addlicense

FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine3.23 AS base
COPY --from=xx / /
RUN apk add --no-cache \
      clang \
      docker \
      file \
      findutils \
      git \
      make \
      protoc \
      protobuf-dev
WORKDIR /src
ENV CGO_ENABLED=0

FROM base AS build-base
COPY go.* .
RUN --mount=type=cache,target=/go/pkg/mod \
    --mount=type=cache,target=/root/.cache/go-build \
    go mod download

FROM build-base AS vendored
RUN --mount=type=bind,target=.,rw \
    --mount=type=cache,target=/go/pkg/mod \
    go mod tidy && mkdir /out && cp go.mod go.sum /out

FROM scratch AS vendor-update
COPY --from=vendored /out /

FROM vendored AS vendor-validate
RUN --mount=type=bind,target=.,rw <<EOT
  set -e
  git add -A
  cp -rf /out/* .
  diff=$(git status --porcelain -- go.mod go.sum)
  if [ -n "$diff" ]; then
    echo >&2 'ERROR: Vendor result differs. Please vendor your package with "make go-mod-tidy"'
    echo "$diff"
    exit 1
  fi
EOT

FROM build-base AS build
ARG BUILD_TAGS
ARG BUILD_FLAGS
ARG TARGETPLATFORM
RUN --mount=type=bind,target=. \
    --mount=type=cache,target=/root/.cache \
    --mount=type=cache,target=/go/pkg/mod \
    --mount=type=bind,from=osxcross,src=/osxsdk,target=/xx-sdk \
    xx-go --wrap && \
    if [ "$(xx-info os)" == "darwin" ]; then export CGO_ENABLED=1; export BUILD_TAGS=fsnotify,$BUILD_TAGS; fi && \
    make build GO_BUILDTAGS="$BUILD_TAGS" DESTDIR=/out && \
    xx-verify --static /out/docker-compose

FROM build-base AS lint
ARG BUILD_TAGS
ENV GOLANGCI_LINT_CACHE=/cache/golangci-lint
RUN --mount=type=bind,target=. \
    --mount=type=cache,target=/root/.cache \
    --mount=type=cache,target=/go/pkg/mod \
    --mount=type=cache,target=/cache/golangci-lint \
    --mount=from=golangci-lint,source=/usr/bin/golangci-lint,target=/usr/bin/golangci-lint \
    golangci-lint cache status && \
    golangci-lint run --build-tags "$BUILD_TAGS" ./...

FROM build-base AS test
ARG CGO_ENABLED=0
ARG BUILD_TAGS
RUN --mount=type=bind,target=. \
    --mount=type=cache,target=/root/.cache \
    --mount=type=cache,target=/go/pkg/mod \
    rm -rf /tmp/coverage && \
    mkdir -p /tmp/coverage && \
    rm -rf /tmp/report && \
    mkdir -p /tmp/report && \
    go run gotest.tools/gotestsum@latest --format testname --junitfile "/tmp/report/report.xml" -- -tags "$BUILD_TAGS" -v -cover -covermode=atomic $(go list  $(TAGS) ./... | grep -vE 'e2e') -args -test.gocoverdir="/tmp/coverage" && \
    go tool covdata percent -i=/tmp/coverage

FROM scratch AS test-coverage
COPY --from=test --link /tmp/coverage /
COPY --from=test --link /tmp/report /

FROM base AS license-set
ARG LICENSE_FILES
RUN --mount=type=bind,target=.,rw \
    --mount=from=addlicense,source=/app/addlicense,target=/usr/bin/addlicense \
    find . -regex "${LICENSE_FILES}" | xargs addlicense -c 'Docker Compose CLI' -l apache && \
    mkdir /out && \
    find . -regex "${LICENSE_FILES}" | cpio -pdm /out

FROM scratch AS license-update
COPY --from=set /out /

FROM base AS license-validate
ARG LICENSE_FILES
RUN --mount=type=bind,target=. \
    --mount=from=addlicense,source=/app/addlicense,target=/usr/bin/addlicense \
    find . -regex "${LICENSE_FILES}" | xargs addlicense -check -c 'Docker Compose CLI' -l apache -ignore validate -ignore testdata -ignore resolvepath -v

FROM base AS docsgen
WORKDIR /src
RUN --mount=target=. \
    --mount=target=/root/.cache,type=cache \
    --mount=type=cache,target=/go/pkg/mod \
    go build -o /out/docsgen ./docs/yaml/main/generate.go

FROM --platform=${BUILDPLATFORM} alpine AS docs-build
RUN apk add --no-cache rsync git
WORKDIR /src
COPY --from=docsgen /out/docsgen /usr/bin
ARG DOCS_FORMATS
RUN --mount=target=/context \
    --mount=target=.,type=tmpfs <<EOT
  set -e
  rsync -a /context/. .
  docsgen --formats "$DOCS_FORMATS" --source "docs/reference"
  mkdir /out
  cp -r docs/reference /out
EOT

FROM scratch AS docs-update
COPY --from=docs-build /out /out

FROM docs-build AS docs-validate
RUN --mount=target=/context \
    --mount=target=.,type=tmpfs <<EOT
  set -e
  rsync -a /context/. .
  git add -A
  rm -rf docs/reference/*
  cp -rf /out/* ./docs/
  if [ -n "$(git status --porcelain -- docs/reference)" ]; then
    echo >&2 'ERROR: Docs result differs. Please update with "make docs"'
    git status --porcelain -- docs/reference
    exit 1
  fi
EOT

FROM scratch AS binary-unix
COPY --link --from=build /out/docker-compose /
FROM binary-unix AS binary-darwin
FROM binary-unix AS binary-linux
FROM scratch AS binary-windows
COPY --link --from=build /out/docker-compose /docker-compose.exe
FROM binary-$TARGETOS AS binary
# enable scanning for this stage
ARG BUILDKIT_SBOM_SCAN_STAGE=true

FROM --platform=${BUILDPLATFORM} alpine AS releaser
WORKDIR /work
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
RUN --mount=from=binary \
    mkdir -p /out && \
    # TODO: should just use standard arch
    TARGETARCH=$([ "$TARGETARCH" = "amd64" ] && echo "x86_64" || echo "$TARGETARCH"); \
    TARGETARCH=$([ "$TARGETARCH" = "arm64" ] && echo "aarch64" || echo "$TARGETARCH"); \
    cp docker-compose* "/out/docker-compose-${TARGETOS}-${TARGETARCH}${TARGETVARIANT}$(ls docker-compose* | sed -e 's/^docker-compose//')"

FROM scratch AS release
COPY --from=releaser /out/ /

FROM --platform=$BUILDPLATFORM alpine AS module-releaser
WORKDIR /work
ARG TARGETOS
RUN --mount=from=binary \
    mkdir -p /cli-plugins/compose/$TARGETOS && \
    cp docker-compose* "/cli-plugins/compose/$TARGETOS/docker-compose$(ls docker-compose* | sed -e 's/^docker-compose//')"

FROM scratch AS module
ARG TARGETOS
COPY --from=module-releaser /cli-plugins/compose/$TARGETOS /cli-plugins/compose/$TARGETOS
COPY ./desktop-module/module-metadata.json /
COPY LICENSE /
WRITEWriteFile· step #8
0s
Dockerfile659 bytes written
text27 lines · 659 chars
# syntax=docker/dockerfile:1


ARG GO_VERSION=1.26.3
ARG BUILD_TAGS="e2e"

FROM golang:tip-alpine3.23 AS builder
ENV CGO_ENABLED=0
WORKDIR /src
RUN apk add --no-cache --no-progress clang docker file findutils git make protoc protobuf-dev

# Install dependencies
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
    --mount=type=cache,target=/root/.cache/go-build \
    go mod download

COPY . .

# Build the project from source
RUN --mount=type=cache,target=/root/.cache \
    make build GO_BUILDTAGS="${BUILD_TAGS}" DESTDIR=/out

FROM scratch AS runtime
COPY --from=builder /out/docker-compose /docker-compose
ENTRYPOINT ["/docker-compose"]
VERIFYVerifyBuild· step #9
10m 43s
VerifyBuildbuild_failed
Build error
Build timed out after 600s
WRITEWriteFile· step #10
0s
Dockerfile837 bytes written
text39 lines · 837 chars
# syntax=docker/dockerfile:1


# Docker Compose CLI build from source

ARG BUILD_TAGS="e2e"

FROM golang:1.26.3-alpine3.23 AS builder
ENV CGO_ENABLED=0
WORKDIR /src

# System dependencies needed for the build
RUN apk add --no-cache --no-progress \
    bash \
    git \
    make \
    protoc \
    protobuf-dev \
    clang \
    findutils

# Pre-copy go mod files to leverage module cache
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
    --mount=type=cache,target=/root/.cache/go-build \
    go mod download

# Copy the rest of the source
COPY . .

# Build the project from source
RUN --mount=type=cache,target=/root/.cache \
    make build GO_BUILDTAGS="${BUILD_TAGS}" DESTDIR=/out

# Final runtime image
FROM scratch AS runtime
COPY --from=builder /out/docker-compose /docker-compose
ENTRYPOINT ["/docker-compose"]
VERIFYVerifyBuild· step #11
10m 52s
VerifyBuildbuild_failed
Build error
Build timed out after 600s
02Iteration 2
WRITEWriteFile· step #1
0s
Dockerfile636 chars
text30 lines · 636 chars
# syntax=docker/dockerfile:1

ARG BUILD_TAGS="e2e"

FROM --platform=$BUILDPLATFORM golang:tip-alpine3.23 AS build

RUN apk add --no-cache clang docker file findutils git make protoc protobuf-dev

WORKDIR /src

COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \
    go mod download

COPY . .

ENV CGO_ENABLED=0

RUN make build GO_BUILDTAGS="$BUILD_TAGS" DESTDIR=/out

FROM alpine:3.18 AS runtime

RUN apk add --no-cache ca-certificates

WORKDIR /usr/local/bin
COPY --from=build /out/docker-compose .
RUN chmod +x docker-compose

ENTRYPOINT ["/usr/local/bin/docker-compose"]
WRITEWriteFile· step #2
0s
Dockerfile1696 chars
text58 lines · 1696 chars
# syntax=docker/dockerfile:1

ARG XX_VERSION=1.9.0
ARG BUILD_TAGS="e2e"
ARG DOCS_FORMATS="md,yaml"
ARG LICENSE_FILES=".*\(Dockerfile\|Makefile\|\.go\|\.hcl\|\.sh\)"

FROM tonistiigi/xx:${XX_VERSION} AS xx

FROM crazymax/osxcross:15.5-alpine AS osxcross

FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint
FROM ghcr.io/google/addlicense:${ADDLICENSE_VERSION} AS addlicense

FROM golang:tip-alpine3.23 AS base
COPY --from=xx / /
COPY --from=osxcross / /
RUN apk add --no-cache \
      clang \
      docker \
      file \
      findutils \
      git \
      make \
      protoc \
      protobuf-dev
WORKDIR /src
ENV CGO_ENABLED=0

FROM base AS build-base
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
    --mount=type=cache,target=/root/.cache/go-build \
    go mod download

FROM build-base AS vendored
RUN --mount=type=bind,target=.,rw \
    --mount=type=cache,target=/go/pkg/mod \
    go mod tidy && mkdir /out && cp go.mod go.sum /out

FROM build-base AS build
ARG BUILD_TAGS
ARG TARGETPLATFORM
RUN --mount=type=bind,target=. \
    --mount=type=cache,target=/root/.cache \
    --mount=type=cache,target=/go/pkg/mod \
    --mount=type=bind,from=osxcross,src=/osxsdk,target=/xx-sdk \
    xx-go --wrap && \
    if [ "$(xx-info os)" = "darwin" ]; then export CGO_ENABLED=1; export BUILD_TAGS=fsnotify,${BUILD_TAGS}; fi && \
    make build GO_BUILDTAGS="${BUILD_TAGS}" DESTDIR=/out && \
    xx-verify --static /out/docker-compose

FROM alpine:3.18 AS runtime
COPY --from=build /out/docker-compose /usr/local/bin/docker-compose
RUN apk --no-cache add ca-certificates
RUN chmod +x /usr/local/bin/docker-compose
ENTRYPOINT ["/usr/local/bin/docker-compose"]
WRITEWriteFile· step #3
0s
Dockerfile817 chars
text36 lines · 817 chars
# syntax=docker/dockerfile:1

ARG BUILD_TAGS="e2e"

FROM --platform=$BUILDPLATFORM golang:tip-alpine3.23 AS build

RUN apk add --no-cache clang docker file findutils git make protoc protobuf-dev

WORKDIR /src

# Cache Go modules download first
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
    --mount=type=cache,target=/root/.cache/go-build \
    go mod download

# Copy the rest of the source
COPY . .

ENV CGO_ENABLED=0

# Build the project, outputting to /out
RUN make build GO_BUILDTAGS="$BUILD_TAGS" DESTDIR=/out

FROM --platform=$BUILDPLATFORM alpine:3.18 AS runtime

RUN apk add --no-cache ca-certificates

WORKDIR /usr/local/bin

COPY --from=build /out/docker-compose /usr/local/bin/docker-compose

RUN chmod +x /usr/local/bin/docker-compose

ENTRYPOINT ["/usr/local/bin/docker-compose"]
WRITEWriteFile· step #4
0s
Dockerfile716 bytes written
text35 lines · 716 chars
# syntax=docker/dockerfile:1

ARG BUILD_TAGS="e2e"

FROM golang:tip-alpine3.23 AS build

RUN apk add --no-cache clang docker file findutils git make protoc protobuf-dev

WORKDIR /src

# Cache module downloads
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
    --mount=type=cache,target=/root/.cache/go-build \
    go mod download

# Copy the rest of the source
COPY . .

ENV CGO_ENABLED=0

RUN make build GO_BUILDTAGS="$BUILD_TAGS" DESTDIR=/out

FROM alpine:3.18 AS runtime

RUN apk add --no-cache ca-certificates

WORKDIR /usr/local/bin

COPY --from=build /out/docker-compose /usr/local/bin/docker-compose

RUN chmod +x /usr/local/bin/docker-compose

ENTRYPOINT ["/usr/local/bin/docker-compose"]
VERIFYVerifyBuild· step #5
11m 07s
VerifyBuildbuild_failed
Build error
Build timed out after 600s
WRITEWriteFile· step #6
0s
Dockerfile664 bytes written
text34 lines · 664 chars
# syntax=docker/dockerfile:1

ARG BUILD_TAGS="e2e"

FROM golang:1.26.3-alpine3.23 AS build

RUN apk add --no-cache clang docker file findutils git make protoc protobuf-dev

WORKDIR /src

# Cache Go modules download
COPY go.mod go.sum ./
RUN go mod download

# Copy the rest of the source
COPY . .

ENV CGO_ENABLED=0

# Build the project, outputting to /out
RUN make build GO_BUILDTAGS="$BUILD_TAGS" DESTDIR=/out

FROM alpine:3.18 AS runtime

RUN apk add --no-cache ca-certificates

WORKDIR /usr/local/bin

COPY --from=build /out/docker-compose /usr/local/bin/docker-compose

RUN chmod +x /usr/local/bin/docker-compose

ENTRYPOINT ["/usr/local/bin/docker-compose"]
VERIFYVerifyBuild· step #7
5m 22s
VerifyBuildbuild_failed
Build error
Summary (under 1500 chars):
- Failing command/step:
  - RUN make build GO_BUILDTAGS="$BUILD_TAGS" DESTDIR=/out (build stage 7/7)

- Exact error messages and exit code to preserve:
  - fatal: not a git repository (or any of the parent directories): .git
  - GO111MODULE=on go build  -trimpath -tags "" -ldflags "-w -X github.com/docker/compose/v5/internal.Version=" -o "/out/docker-compose" ./cmd
  - ... (continued) unicode: write /tmp/go-build1844865379/b048/importcfg: no space left on device
  - github.com/docker/cli/cli-plugins/metadata: mkdir /tmp/go-build1844865379/b064/: no space left on device
  - encoding: mkdir /tmp/go-build1844865379/b072/: no space left on device
  - ... (additional similar mkdir/no space left on device lines)
  - runtime: compile: writing output: write $WORK/b010/_pkg_.a: no space left on device
  - make: *** [Makefile:61: build] Error 1
  - ERROR: failed to build: failed to solve: process "/bin/sh -c make build GO_BUILDTAGS=\"$BUILD_TAGS\" DESTDIR=/out" did not complete successfully: exit code: 2

- Missing packages/files mentioned:
  - The log shows a git repo context issue (not a git repository), not missing packages per se. The .git context appears unavailable or not present.

- Version mismatch / base image info:
  - Build uses golang:1.26.3-alpine3.23 and alpine:3.18 (specified with sha256 digests). No explicit version mismatch is stated in the error output.

- Root causes hinted:
  - Not a git repository (.git) suggests Git metadata may be missing in the build context.
  - Repeated “no space left on device” errors indicate insufficient disk space during Go compile/build, leading to the final exit code 2.
WRITEWriteFile· step #8
0s
Dockerfile799 bytes written
text37 lines · 799 chars
# syntax=docker/dockerfile:1

ARG BUILD_TAGS="e2e"
ARG VERSION="dev"

FROM golang:1.26.3-alpine3.23 AS build

RUN apk add --no-cache clang docker file findutils git make protoc protobuf-dev

WORKDIR /src

# Cache Go modules download
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
    --mount=type=cache,target=/root/.cache/go-build \
    go mod download

# Copy the rest of the source
COPY . .

ENV CGO_ENABLED=0

# Build the project, outputting to /out
RUN make build GO_BUILDTAGS="$BUILD_TAGS" DESTDIR=/out VERSION="$VERSION"

FROM alpine:3.18 AS runtime

RUN apk add --no-cache ca-certificates

WORKDIR /usr/local/bin

COPY --from=build /out/docker-compose /usr/local/bin/docker-compose

RUN chmod +x /usr/local/bin/docker-compose

ENTRYPOINT ["/usr/local/bin/docker-compose"]
VERIFYVerifyBuild· step #9
10m 49s
VerifyBuildbuild_failed
Build error
Build timed out after 600s
WRITEWriteFile· step #10
1s
Dockerfile664 bytes written
text34 lines · 664 chars
# syntax=docker/dockerfile:1

ARG BUILD_TAGS="e2e"

FROM golang:1.20.4-alpine3.17 AS build

RUN apk add --no-cache clang docker file findutils git make protoc protobuf-dev

WORKDIR /src

# Cache Go modules download
COPY go.mod go.sum ./
RUN go mod download

# Copy the rest of the source
COPY . .

ENV CGO_ENABLED=0

# Build the project, outputting to /out
RUN make build GO_BUILDTAGS="$BUILD_TAGS" DESTDIR=/out

FROM alpine:3.17 AS runtime

RUN apk add --no-cache ca-certificates

WORKDIR /usr/local/bin

COPY --from=build /out/docker-compose /usr/local/bin/docker-compose

RUN chmod +x /usr/local/bin/docker-compose

ENTRYPOINT ["/usr/local/bin/docker-compose"]
VERIFYVerifyBuild· step #11
3m 08s
VerifyBuildbuild_failed
Build error
Failing step
- [build 5/7] RUN go mod download

Exact error message and exit code
> [build 5/7] RUN go mod download:
1.367 go: errors parsing go.mod:
1.367 /src/go.mod:3: invalid go version '1.25.5': must match format 1.23
1.367 ERROR: process "/bin/sh -c go mod download" did not complete successfully: exit code: 1

Key details
- The error references /src/go.mod (line 3) containing an invalid go version: '1.25.5'
- Version mismatch information: the message says the version must match format 1.23 (i.e., Go expects a version like 1.xx).
WRITEWriteFile· step #12
0s
Dockerfile877 bytes written
text38 lines · 877 chars
# syntax=docker/dockerfile:1

ARG BUILD_TAGS="e2e"

FROM golang:1.26.3-alpine3.23 AS build

RUN apk add --no-cache clang docker file findutils git make protoc protobuf-dev

WORKDIR /src

# Prepare Go module files and fix known invalid Go version in go.mod
COPY go.mod go.sum ./
RUN sed -i 's/go 1.25.5/go 1.25/' go.mod
RUN --mount=type=cache,target=/go/pkg/mod \
    --mount=type=cache,target=/root/.cache/go-build \
    go mod download

# Copy the rest of the source
COPY . .

ENV CGO_ENABLED=0

# Build the project, outputting to /out
RUN --mount=type=bind,source=. \
    make build GO_BUILDTAGS="$BUILD_TAGS" DESTDIR=/out

FROM alpine:3.18 AS runtime

RUN apk add --no-cache ca-certificates

WORKDIR /usr/local/bin

COPY --from=build /out/docker-compose /usr/local/bin/docker-compose

RUN chmod +x /usr/local/bin/docker-compose

ENTRYPOINT ["/usr/local/bin/docker-compose"]