github.com/MetalBlockchain/metalgo@v1.11.9/tests/antithesis/avalanchego/Dockerfile.builder-instrumented (about)

     1  # The version is supplied as a build argument rather than hard-coded
     2  # to minimize the cost of version changes.
     3  ARG GO_VERSION
     4  
     5  # Antithesis: Getting the Antithesis golang instrumentation library
     6  FROM docker.io/antithesishq/go-instrumentor AS instrumentor
     7  
     8  # ============= Instrumentation Stage ================
     9  FROM golang:$GO_VERSION-bullseye
    10  
    11  WORKDIR /build
    12  # Copy and download avalanche dependencies using go mod
    13  COPY go.mod .
    14  COPY go.sum .
    15  RUN go mod download
    16  
    17  # Copy the code into the container
    18  COPY . .
    19  
    20  # Ensure pre-existing builds are not available for inclusion in the final image
    21  RUN [ -d ./build ] && rm -rf ./build/* || true
    22  
    23  # Keep the commit hash to easily verify the exact version that is running
    24  RUN git rev-parse HEAD > ./commit_hash.txt
    25  
    26  # Copy the instrumentor and supporting files to their correct locations
    27  COPY --from=instrumentor /opt/antithesis /opt/antithesis
    28  COPY --from=instrumentor /opt/antithesis/lib /lib
    29  
    30  # Create the destination output directory for the instrumented code
    31  RUN mkdir -p /avalanchego_instrumented
    32  
    33  # Park the .git file in a safe location
    34  RUN mkdir -p /opt/tmp/
    35  RUN cp -r .git /opt/tmp/
    36  
    37  # Instrument avalanchego
    38  RUN /opt/antithesis/bin/goinstrumentor \
    39      -stderrthreshold=INFO \
    40      -antithesis /opt/antithesis/instrumentation \
    41      . \
    42      /avalanchego_instrumented
    43  
    44  WORKDIR /avalanchego_instrumented/customer
    45  RUN go mod download
    46  RUN ln -s /opt/tmp/.git .git