docker-compose
SUCCESS
4m 41s
History Source
SummaryIterations1Transcript5Dockerfile
01Iteration 1
WRITEWriteFile· step #1
0s
Dockerfile1332 chars
text49 lines · 1332 chars
# syntax=docker/dockerfile:1

# Build the compose binary from source using a Debian-based Go image
# Base image aligns with the provided blueprint: golang:1.25.8-bookworm
FROM --platform=$BUILDPLATFORM golang:1.25.8-bookworm AS base
WORKDIR /src

# Install required build tools and dependencies
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
      clang \
      docker.io \
      file \
      findutils \
      git \
      make \
      protobuf-compiler \
      libprotobuf-dev && \
    rm -rf /var/lib/apt/lists/*

# Fetch Go module dependencies first to leverage layer caching
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 full source code
COPY . .

# Build the project from source
# DESTDIR=/out will place the binary at /out/docker-compose
RUN --mount=type=cache,target=/root/.cache \
    GO111MODULE=on \
    GOFLAGS= \
    make build DESTDIR=/out

# Runtime image containing the built binary
FROM debian:bookworm-slim AS runtime
WORKDIR /app

# Copy the docker-compose binary from the build stage
COPY --from=base /out/docker-compose /docker-compose

# Ensure the binary is runnable
RUN chmod +x /docker-compose

# Default entrypoint is the docker-compose binary
ENTRYPOINT ["/docker-compose"]
WRITEWriteFile· step #2
0s
Dockerfile1337 chars
text49 lines · 1337 chars
# syntax=docker/dockerfile:1

# Build the compose binary from source using a Debian-based Go image
# Base image aligns with the provided blueprint: golang:1.25.8-bookworm
ARG BUILDPLATFORM
FROM --platform=${BUILDPLATFORM} golang:1.25.8-bookworm AS base
WORKDIR /src

# Install required build tools and dependencies
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
      clang \
      docker.io \
      file \
      findutils \
      git \
      make \
      protobuf-compiler \
      libprotobuf-dev && \
    rm -rf /var/lib/apt/lists/*

# Fetch Go module dependencies first to leverage layer caching
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 full source code
COPY . .

# Build the project from source
# DESTDIR=/out will place the binary at /out/docker-compose
RUN --mount=type=cache,target=/root/.cache \
    GO111MODULE=on \
    make build DESTDIR=/out

# Runtime image containing the built binary
FROM debian:bookworm-slim AS runtime
WORKDIR /app

# Copy the docker-compose binary from the build stage
COPY --from=base /out/docker-compose /docker-compose

# Ensure the binary is runnable
RUN chmod +x /docker-compose

# Default entrypoint is the docker-compose binary
ENTRYPOINT ["/docker-compose"]
WRITEWriteFile· step #3
1s
Dockerfile1260 bytes written
text47 lines · 1260 chars
# syntax=docker/dockerfile:1

# Build the compose binary from source using a Debian-based Go image
# Base image aligned with the blueprint: golang:1.25.8-bookworm
FROM golang:1.25.8-bookworm AS build
WORKDIR /src

# Install required build tools and dependencies
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
      clang \
      file \
      findutils \
      git \
      make \
      protobuf-compiler \
      libprotobuf-dev && \
    rm -rf /var/lib/apt/lists/*

# Enable Go module caching and fetch dependencies 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 full source code
COPY . .

# Build the project from source
# DESTDIR=/out will place the binary at /out/docker-compose
RUN --mount=type=cache,target=/root/.cache \
    GO111MODULE=on \
    make build DESTDIR=/out

# Runtime image containing the built binary
FROM debian:bookworm-slim AS runtime
WORKDIR /app

# Copy the docker-compose binary from the build stage
COPY --from=build /out/docker-compose /docker-compose

# Ensure the binary is runnable
RUN chmod +x /docker-compose

# Default entrypoint is the docker-compose binary
ENTRYPOINT ["/docker-compose"]
WRITEWriteFile· step #4
0s
.dockerignore104 bytes written
dockerignore14 lines · 104 chars
.git
vendor/
node_modules/
docs/
docs/
*.log
*.tmp
*.tar
*.tar.gz
*.zip
.gitignore
Dockerfile
README.md
VERIFYVerifyBuild· step #5
2m 19s
VerifyBuildaccepted
Smoke [PASS]: /docker-compose --version
Smoke [PASS]: /docker-compose --help | head -n 5
Smoke [PASS]: test -x /docker-compose