-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup: Simplify generation of docker compose artifacts
- Loading branch information
Showing
8 changed files
with
44 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,6 @@ | ||
# The version is supplied as a build argument rather than hard-coded | ||
# to minimize the cost of version changes. | ||
ARG GO_VERSION | ||
|
||
# NODE_IMAGE needs to identify an existing subnet-evm node image and should include the tag | ||
ARG NODE_IMAGE | ||
|
||
# ============= Node Image State ================ | ||
FROM $NODE_IMAGE AS node | ||
|
||
# If this is not an instrumented node image, fake the antithesis dependencies expected by the builder. | ||
RUN [ ! -d /symbols ] && mkdir /symbols || true | ||
RUN [ ! -f /usr/lib/libvoidstar.so ] && touch /usr/lib/libvoidstar.so || true | ||
|
||
# ============= Compilation Stage ================ | ||
FROM golang:$GO_VERSION-bullseye AS builder | ||
|
||
WORKDIR /build | ||
# Copy and download avalanche dependencies using go mod | ||
COPY go.mod . | ||
COPY go.sum . | ||
RUN go mod download | ||
|
||
# Copy the code into the container | ||
COPY . . | ||
|
||
# IMAGE_TAG should be set to the tag for the images in the generated docker compose file. | ||
ARG IMAGE_TAG=latest | ||
|
||
# Copy the avalanchego binary and plugin from the node image | ||
RUN mkdir -p ./build/plugins | ||
COPY --from=node /avalanchego/build/avalanchego ./build | ||
COPY --from=node /avalanchego/build/plugins/* ./build/plugins/ | ||
|
||
# Copy antithesis dependencies required by instrumented binaries | ||
COPY --from=node /symbols /symbols | ||
COPY --from=node /usr/lib/libvoidstar.so /usr/lib/libvoidstar.so | ||
|
||
# Generate docker compose configuration. If the command fails, it will likely be due to a | ||
# node configuration problem. Attempt to start a node with the same configuration so that | ||
# its logging output will be available to aid in troubleshooting. | ||
RUN export AVALANCHEGO_PATH=./build/avalanchego\ | ||
export AVALANCHEGO_PLUGIN_DIR=./build/plugins;\ | ||
TARGET_PATH=./build IMAGE_TAG="$IMAGE_TAG" go run ./tests/antithesis/gencomposeconfig\ | ||
|| ${AVALANCHEGO_PATH} --log-display-level=debug\ | ||
--config-file=$(find /root/.tmpnet/networks -name "flags.json" | head -n 1) | ||
|
||
# ============= Cleanup Stage ================ | ||
FROM scratch AS execution | ||
|
||
# Copy the docker compose file and volumes into the container | ||
COPY --from=builder /build/build/docker-compose.yml /docker-compose.yml | ||
COPY --from=builder /build/build/volumes /volumes | ||
# Copy config artifacts from the build path. For simplicity, artifacts | ||
# are built outside of the docker image. | ||
COPY ./build/antithesis/docker-compose.yml / | ||
COPY ./build/antithesis/volumes /volumes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters